Server frontend build files from backend server.

This commit is contained in:
2020-07-18 22:23:22 +02:00
parent 7ce54306b7
commit 5d320b9d54
2 changed files with 6 additions and 1 deletions

View File

@@ -23,7 +23,11 @@ router.get('/product/:id', productsController.productById)
router.post('/product', productsController.addNewProduct)
router.post('/variation/:id', variationsController.addNewVariationToProduct);
app.use("/public", express.static(path.join(__dirname, "public")));
app.use("/dist", express.static(path.join(__dirname, "/../public/dist")));
app.use('/api', router);
app.use('/', (req, res) => res.sendFile(path.join(__dirname + "/../public/index.html")));
console.log(`Planetposen backend running on port: ${PORT}`)
server.listen(PORT);