From 95837beaf7818f3159d40fb630bc43a436728d8e Mon Sep 17 00:00:00 2001 From: knotteye Date: Fri, 16 Oct 2020 21:57:24 -0500 Subject: [PATCH] Make server side rendering fully configurable --- src/http.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/http.ts b/src/http.ts index 967a1f3..f83b61b 100644 --- a/src/http.ts +++ b/src/http.ts @@ -12,9 +12,6 @@ import * as chatInteg from "./chat"; import { config } from "./config"; import { readdir, readFileSync, writeFileSync } from "fs"; import { JWT, JWK } from "jose"; -import { strict } from "assert"; -import { parse } from "path"; -import { isBuffer } from "util"; const app = express(); const server = http.createServer(app); @@ -55,12 +52,15 @@ async function init(){ }); } app.disable('x-powered-by'); - //site handlers - //await initSite(config['satyr']['registration']); - //api handlers + //server-side site routes + if(config['http']['server_side_render']) + await initSite(config['satyr']['registration']); + //api routes await initAPI(); - //static files if nothing else matches first + //static files if nothing else matches app.use(express.static(config['http']['directory'])); + //client-side site routes + if(!config['http']['server_side_render']) await initFE(); //404 Handler app.use(function (req, res, next) {