added dev and prod scripts, serve static content

This commit is contained in:
notnull 2019-04-01 09:55:08 -07:00
parent b5c31ddf25
commit 6a5abcbe70
2 changed files with 7 additions and 5 deletions

View File

@ -4,7 +4,9 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "webpack-dev-server --config ./webpack.config.js --mode development", "dev": "webpack-dev-server --config ./webpack.config.js --mode development",
"build": "webpack --config ./webpack.config.js --mode production",
"prod": "node server.js",
"test": "echo \"No test specified\" && exit 0" "test": "echo \"No test specified\" && exit 0"
}, },
"keywords": [], "keywords": [],

View File

@ -17,9 +17,9 @@ app.use(express.static(path.join(__dirname, 'dist')))
//http://localhost:31337 //http://localhost:31337
app.use(proxy('/api', { target: 'http://localhost:1337' })) app.use(proxy('/api', { target: 'http://localhost:1337' }))
// app.get('*', (req, res) => { app.get('*', (req, res) => {
// res.sendFile(path.resolve(__dirname, 'dist', 'index.html')) res.sendFile(path.resolve(__dirname, 'dist', 'index.html'))
// }) })
// error handling endware // error handling endware
app.use((err, req, res, next) => { app.use((err, req, res, next) => {