Make server side rendering fully configurable

merge-requests/27/head
knotteye 2020-10-16 21:57:24 -05:00
parent 961b5fe648
commit 95837beaf7
1 changed files with 7 additions and 7 deletions

View File

@ -12,9 +12,6 @@ import * as chatInteg from "./chat";
import { config } from "./config"; import { config } from "./config";
import { readdir, readFileSync, writeFileSync } from "fs"; import { readdir, readFileSync, writeFileSync } from "fs";
import { JWT, JWK } from "jose"; import { JWT, JWK } from "jose";
import { strict } from "assert";
import { parse } from "path";
import { isBuffer } from "util";
const app = express(); const app = express();
const server = http.createServer(app); const server = http.createServer(app);
@ -55,12 +52,15 @@ async function init(){
}); });
} }
app.disable('x-powered-by'); app.disable('x-powered-by');
//site handlers //server-side site routes
//await initSite(config['satyr']['registration']); if(config['http']['server_side_render'])
//api handlers await initSite(config['satyr']['registration']);
//api routes
await initAPI(); await initAPI();
//static files if nothing else matches first //static files if nothing else matches
app.use(express.static(config['http']['directory'])); app.use(express.static(config['http']['directory']));
//client-side site routes
if(!config['http']['server_side_render'])
await initFE(); await initFE();
//404 Handler //404 Handler
app.use(function (req, res, next) { app.use(function (req, res, next) {