{
- "site_title": "Olly's website",
+ "site_title": "NDCODE",
"navigation": [
- "/index.html"
+ "/index.html",
+ "/team.html",
+ "/case_studies.html",
+ "/free_reports.html",
+ "/online_courses.html",
+ "/forum.html",
+ "/contact.html"
],
"page_to_title": {
- "/index.html": "Home"
+ "/index.html": "Home",
+ "/team.html": "Team",
+ "/case_studies.html": "Case studies",
+ "/free_reports.html": "Free reports",
+ "/online_courses.html": "Online courses",
+ "/forum.html": "Forum",
+ "/contact.html": "Contact",
+ "/signup.html": "Sign up",
+ "/login.html": "Log in",
+ "/recover_account.html": "Recover account"
}
}
-let jst_server = require('@ndcode/jst_server')
-
-return {
- "enable_caching": false,
- "listen": [
- {"port": 8080},
- {"port": 8443, "protocol": "https:"}
- ],
- "mime_types": {
- ".css": "text/css; charset=utf-8",
- ".html": "text/html; charset=utf-8",
- ".ico": "image/x-icon",
- ".jpg": "image/jpeg",
- ".jpeg": "image/jpeg",
- ".js": "application/javascript; charset=utf-8",
- ".json": "application/json; charset=utf-8",
- ".png": "image/png",
- ".svg": "image/svg+xml",
- ".xml": "text/xml; charset=utf-8"
+return async (resources, prev_server) => new _jst_server.Server(
+ resources,
+ {
+ hosts: {
+ 'localhost': {
+ type: 'site',
+ root: '.'
+ },
+ 'localhost.localdomain': {
+ type: 'redirect',
+ host: 'localhost'
+ }
+ }
},
- sites: {
- 'localhost': new jst_server.SiteDefault(_server, '.'),
- 'localhost.localdomain': new jst_server.SiteRedirect(_server, 'localhost')
- }
-}
+ prev_server
+)
-let jst_server = require('@ndcode/jst_server')
+//let EmailJSCache = require('@ndcode/emailjs_cache')
+//let ZettairCache = require('@ndcode/zettair_cache')
+let assert = require('assert')
-let CustomSite = function(server, root) {
+let CustomSite = function(resources, root, options, prev_site) {
if (!this instanceof CustomSite)
throw Error('CustomSite is a constructor')
- jst_server.SiteRoot.call(this, server, root)
+ _jst_server.Site.call(this, resources, root, options, prev_site)
+
+ this.emailjs_cache = undefined
+ this.zettair_cache = undefined
}
-CustomSite.prototype = Object.create(jst_server.SiteRoot.prototype)
+CustomSite.prototype = Object.create(_jst_server.Site.prototype)
+
+//CustomSite.prototype.start = async function() {
+// await _jst_server.Site.prototype.start.call(this)
+//
+// assert(this.emailjs_cache === undefined)
+// this.emailjs_cache = await this.resources.ref(
+// 'emailjs_cache',
+// async () => new EmailJSCache(true)
+// )
+//
+// assert(this.zettair_cache === undefined)
+// this.zettair_cache = await this.resources.ref(
+// 'zettair_cache',
+// async () => new ZettairCache(true)
+// )
+//}
+//
+//CustomSite.prototype.stop = async function() {
+// await _jst_server.Site.prototype.stop.call(this)
+//
+// assert(this.emailjs_cache !== undefined)
+// await this.resources.unref('emailjs_cache')
+//
+// assert(this.zettair_cache !== undefined)
+// await this.resources.unref('zettair_cache')
+//}
+//
+//CustomSite.prototype.kick = async function() {
+// await _jst_server.Site.prototype.kick.call(this)
+//
+// assert(this.emailjs_cache !== undefined)
+// this.emailjs_cache.kick()
+//
+// assert(this.zettair_cache !== undefined)
+// this.zettair_cache.kick()
+//}
+//
+//CustomSite.prototype.get_emailjs = function(pathname) {
+// return /*await*/ this.emailjs_cache.get(this.root + pathname)
+//}
+//
+//CustomSite.prototype.get_zettair = function(pathname) {
+// return /*await*/ this.zettair_cache.get(this.root + pathname)
+//}
CustomSite.prototype.respond = async function(env) {
if (
- env.pathname === '/node_modules' ||
- env.pathname.slice(0, 14) === '/node_modules/' ||
- env.pathname === '/package.json'
+ env.parsed_url.pathname === '/node_modules' ||
+ env.parsed_url.pathname.slice(0, 14) === '/node_modules/' ||
+ env.parsed_url.pathname === '/package.json'
) {
- this.die(env, `banned file ${env.pathname}`)
+ this.die(env, `banned file ${env.parsed_url.pathname}`)
return
}
- return /*await*/ jst_server.SiteRoot.prototype.respond.call(this, env)
+ return /*await*/ _jst_server.Site.prototype.respond.call(this, env)
}
-return new CustomSite(_server, _root)
+return async (resources, root, prev_site) => new CustomSite(
+ resources,
+ root,
+ {},
+ prev_site
+)