diff --git a/config/webpack.config.common.js b/config/webpack.config.common.js index 50680e6..5734f35 100644 --- a/config/webpack.config.common.js +++ b/config/webpack.config.common.js @@ -72,6 +72,7 @@ const webpackConfig = function(isDev) { plugins: [ new VueLoaderPlugin(), new webpack.DefinePlugin({ + __ENV__: JSON.stringify(process.env.NODE_ENV), __NAME__: JSON.stringify(env.name), __PHONE__: JSON.stringify(env.phone), __PRICE__: env.price, diff --git a/middleware/mustBeAuthenticated.js b/middleware/mustBeAuthenticated.js index 70c90e1..a173fb2 100644 --- a/middleware/mustBeAuthenticated.js +++ b/middleware/mustBeAuthenticated.js @@ -1,5 +1,9 @@ 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()) { return res.status(401).send({ success: false, diff --git a/package.json b/package.json index 631688b..d52ee67 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,11 @@ "description": "", "main": "server.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", "start": "node server.js", + "build": "cross-env NODE_ENV=production webpack --progress --hide-modules", "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": "", "license": "ISC", diff --git a/src/mixins/ServiceWorkerMixin.js b/src/mixins/ServiceWorkerMixin.js index 1522cac..5442545 100644 --- a/src/mixins/ServiceWorkerMixin.js +++ b/src/mixins/ServiceWorkerMixin.js @@ -11,6 +11,10 @@ var serviceWorkerRegistrationMixin = { } this.registerPushListener(); this.registerServiceWorker(); + if (__ENV__ == "development") { + console.info("Service worker manually disabled while on localhost.") + } else { + } }, methods: { registerPushListener: function() {