I just want to set environment form development,staging and production in my project of express.jsTo set these environments I use module config https://www.npmjs.com/package/config
and i created file development.js in config folder
and my code is for file development.js
import db from './db';module.exports = { host: '0.0.0.0', port: process.env.PORT || 5000, secret: process.env.SECRET || 'supersecret', db: db.development, base_url: process.env.BASEURL || 'http://192.168.1.153:5000', fornt_url: process.env.FRONT_BASEURL || 'http://localhost:4200/#', savePath:"./uploads/"};
and i also update my package.json file in script as
"scripts": {"test": "node app.js","development": "NODE_ENV=development nodemon app.js","staging": "NODE_ENV=staging node app.js","production": "NODE_ENV=production node app.js" },
and when i run my project i got following error, please help to resolve this
[nodemon] starting `node app.js`/data/node/tempfu-api/node_modules/config/lib/config.js:963 throw new Error("Cannot parse config file: '"+ fullFilename +"': "+ e3); ^Error: Cannot parse config file: '/data/node/tempfu-api/config/development.js': SyntaxError: Unexpected token import at Config.util.parseFile (/data/node/tempfu-api/node_modules/config/lib/config.js:963:11) at /data/node/tempfu-api/node_modules/config/lib/config.js:725:28 at Array.forEach (<anonymous>) at /data/node/tempfu-api/node_modules/config/lib/config.js:721:14 at Array.forEach (<anonymous>) at Config.util.loadFileConfigs (/data/node/tempfu-api/node_modules/config/lib/config.js:720:13) at new Config (/data/node/tempfu-api/node_modules/config/lib/config.js:136:27) at Object.<anonymous> (/data/node/tempfu-api/node_modules/config/lib/config.js:1797:31) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object.<anonymous> (/data/node/tempfu-api/helpers/mysql.js:1:78) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17)