manuals, deploy, docs

This commit is contained in:
2024-11-29 19:13:53 +02:00
parent 824249ed75
commit e264956831
11 changed files with 310 additions and 21 deletions
+5 -17
View File
@@ -73,25 +73,13 @@ class WebServer {
* @param {App} app The application instance
*/
async start(app) {
let indexFile = app.root + '/index.html';
let indexFileContent = fs.readFileSync(indexFile, { encoding: 'utf-8' });
function index(req, res) {
//res.sendFile(indexFile);
res.send(indexFileContent.replace(/\#NONCE\#/g, res.locals.cspNonce));
}
this.xapp.get('/', index);
// app.config.langs.forEach(l => {
// this.xapp.use('/' + l.code, index);
// })
this.xapp.use(express.static(`${this.app.root}/dist/`));
this.xapp.use(express.static(`${this.app.root}/frontend/`));
this.xapp.use((req, res, next) => {
if (req.method == 'GET' || req.method == 'POST') {
if (req.method == 'GET'){
res.sendFile(`${this.app.root}/frontend/index.html`);
}else if (req.method == 'POST') {
return res.status(404).end();
} else next();
});