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

@@ -6,7 +6,8 @@
"repository": "git@github.com:kevinmidboe/planetposen.git",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --progress",
"server": "NODE_PATH=server node server/app.js"
"server": "NODE_PATH=server node server/app.js",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"author": "KevinMidboe <kevin.midboe@gmail.com>",
"license": "MIT",

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);