Reputation: 219
I am building an node
application, it has 3 environments names are development,testing and production
. Each environment has their own hostnames and port numbers. like in the following way
{
"development":{
"host":"develop.com",
"port":"2000"
},
"testing":{
"host":"testing.com",
"port":"2001"
},
"production":{
"host":"production.com",
"port":"2002"
}
}
While running my node
application, I used to pass environment name as a command argument. like
node server.js development
(or)
node server.js production
Instead of running application manually along with environment name, I want to implement with node scripts, so I have tried in the following way.
package.json
{
"developemnt":"node server.js development",
"production":"node server.js production",
"testing":"node server.js testing"
}
What I thought, Instead of node server.js development
, I can run npm development
. This way I have made it, but it's not working. Regarding this, I have read npm script
documentaion, as per documentation It's not possible,so is there any way to implement this.
Thanks
Upvotes: 3
Views: 196