diff --git a/src/backend/FrontblockAdmin.ts b/src/backend/FrontblockAdmin.ts index 969cd19..e652163 100644 --- a/src/backend/FrontblockAdmin.ts +++ b/src/backend/FrontblockAdmin.ts @@ -185,6 +185,9 @@ export class FrontblockAdmin extends ConfigLoader{ this.express = express() this.express.use('/', express.static('static')) + /** + * get the compiled FrontendPlugins + */ this.express.get('/plugins/:id'+".js", (request, response) => { let frontend = this.pm.getFrontend(request.params.id) response.status(200) @@ -192,8 +195,23 @@ export class FrontblockAdmin extends ConfigLoader{ response.send(frontend) }) - this.express.get("*", (req, res) => { - res.status(301).redirect('/') + /** + * serve the index.html from the static folder + */ + this.express.get("/", (request, response) => { + response.status(200) + response.sendFile('index.html'); + }) + + /** + * redirect all the other traffic to the single + * side app to the main entry point from where + * a webpacked and rolled up index.html is serverd + * and angular takes over routing + */ + this.express.get("*", (request, response) => { + response.status(301) + response.redirect('/') }) this.httpServer = new http.Server(this.express)