New command start-dev runs with node_env flag set to development.
This commit is contained in:
		| @@ -72,6 +72,7 @@ const webpackConfig = function(isDev) { | |||||||
|     plugins: [ |     plugins: [ | ||||||
|       new VueLoaderPlugin(), |       new VueLoaderPlugin(), | ||||||
|       new webpack.DefinePlugin({ |       new webpack.DefinePlugin({ | ||||||
|  |         __ENV__: JSON.stringify(process.env.NODE_ENV), | ||||||
|         __NAME__: JSON.stringify(env.name), |         __NAME__: JSON.stringify(env.name), | ||||||
|         __PHONE__: JSON.stringify(env.phone), |         __PHONE__: JSON.stringify(env.phone), | ||||||
|         __PRICE__: env.price, |         __PRICE__: env.price, | ||||||
|   | |||||||
| @@ -1,5 +1,9 @@ | |||||||
| const mustBeAuthenticated = (req, res, next) => { | const mustBeAuthenticated = (req, res, next) => { | ||||||
|   console.log(req.isAuthenticated()); |   if (process.env.NODE_ENV == "development") { | ||||||
|  |     console.info(`Restricted endpoint ${req.originalUrl}, but running in dev mode.`) | ||||||
|  |     return next(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   if (!req.isAuthenticated()) { |   if (!req.isAuthenticated()) { | ||||||
|     return res.status(401).send({ |     return res.status(401).send({ | ||||||
|       success: false, |       success: false, | ||||||
|   | |||||||
| @@ -4,10 +4,11 @@ | |||||||
|   "description": "", |   "description": "", | ||||||
|   "main": "server.js", |   "main": "server.js", | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "test": "echo \"Error: no test specified\" && exit 1", |  | ||||||
|     "start": "node server.js", |     "start": "node server.js", | ||||||
|  |     "build": "cross-env NODE_ENV=production webpack --progress --hide-modules", | ||||||
|     "dev": "cross-env NODE_ENV=development webpack-dev-server", |     "dev": "cross-env NODE_ENV=development webpack-dev-server", | ||||||
|     "build": "cross-env NODE_ENV=production webpack --progress --hide-modules" |     "start-dev": "cross-env NODE_ENV=development node server.js", | ||||||
|  |     "test": "echo \"Error: no test specified\" && exit 1" | ||||||
|   }, |   }, | ||||||
|   "author": "", |   "author": "", | ||||||
|   "license": "ISC", |   "license": "ISC", | ||||||
|   | |||||||
| @@ -11,6 +11,10 @@ var serviceWorkerRegistrationMixin = { | |||||||
|     } |     } | ||||||
|     this.registerPushListener(); |     this.registerPushListener(); | ||||||
|     this.registerServiceWorker(); |     this.registerServiceWorker(); | ||||||
|  |     if (__ENV__ == "development") { | ||||||
|  |       console.info("Service worker manually disabled while on localhost.") | ||||||
|  |     } else { | ||||||
|  |     } | ||||||
|   }, |   }, | ||||||
|   methods: { |   methods: { | ||||||
|     registerPushListener: function() { |     registerPushListener: function() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user