werks in docker

This commit is contained in:
Daniel Hübleitner
2019-08-11 15:28:31 +02:00
parent 16448113fc
commit 92bc92e18f
+20 -2
View File
@@ -185,6 +185,9 @@ export class FrontblockAdmin extends ConfigLoader<AdminConf>{
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<AdminConf>{
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)