mirror of
				https://github.com/KevinMidboe/planetposen.git
				synced 2025-10-29 17:50:32 +00:00 
			
		
		
		
	Server frontend build files from backend server.
This commit is contained in:
		| @@ -6,7 +6,8 @@ | |||||||
|   "repository": "git@github.com:kevinmidboe/planetposen.git", |   "repository": "git@github.com:kevinmidboe/planetposen.git", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "dev": "cross-env NODE_ENV=development webpack-dev-server --progress", |     "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>", |   "author": "KevinMidboe <kevin.midboe@gmail.com>", | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   | |||||||
| @@ -23,7 +23,11 @@ router.get('/product/:id', productsController.productById) | |||||||
| router.post('/product', productsController.addNewProduct) | router.post('/product', productsController.addNewProduct) | ||||||
|  |  | ||||||
| router.post('/variation/:id', variationsController.addNewVariationToProduct); | 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('/api', router); | ||||||
|  | app.use('/', (req, res) => res.sendFile(path.join(__dirname + "/../public/index.html"))); | ||||||
|  |  | ||||||
| console.log(`Planetposen backend running on port: ${PORT}`) | console.log(`Planetposen backend running on port: ${PORT}`) | ||||||
| server.listen(PORT); | server.listen(PORT); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user