Don't call the template immediately on retrieval, user code can do this itself
authorNick Downing <downing.nick@gmail.com>
Sun, 14 Oct 2018 23:43:43 +0000 (10:43 +1100)
committerNick Downing <downing.nick@gmail.com>
Sun, 14 Oct 2018 23:43:43 +0000 (10:43 +1100)
site.js

diff --git a/site.js b/site.js
index 77cd054..22ed278 100644 (file)
--- a/site.js
+++ b/site.js
@@ -151,28 +151,13 @@ let app = async (site, site_root, req, res, protocol) => {
           site_root: site_root
         }
         let _out = text => {buffers.push(Buffer.from(text))}
-        let _req = async (path, type) => {
-          path = (
+        let _req = async path => /*await*/ resources.get_jst(
+          (
             path.length > 0 && path.charAt(0) === '/' ?
             site_root :
             site_root + dir_name + '/'
           ) + path
-          switch (type) {
-          case undefined:
-            return /*await*/ (await resources.get_jst(path))(_env, _out, _req)
-          case 'email':
-            return /*await*/ resources.get_email(path)
-          case 'jst':
-            return /*await*/ resources.get_jst(path)
-          case 'json':
-            return /*await*/ resources.get_json(path)
-          case 'text':
-            return /*await*/ resources.get_text(path)
-          case 'zet':
-            return /*await*/ resources.get_zet(path)
-          }
-          assert(false)
-        }
+        )
         await _req(temp)
         let data = Buffer.concat(buffers)
         console.log(