A large number of documentation and blogs recommend running the server code through npm start
, and Amazon AWS documentation is no exception.
Why is it bad?
Let's create a project with common package.json
"sripts": {
"start": "node server.js"
}
and start our server: npm start
.
The server runs, but what about our processes?
OMG! The npm process is not only alive but also uses almost the same amount of memory as our server!
Moreover, if we create our package.json with several tasks:
"sripts": {
"_serve": "node server.js"
"start": "config-something.sh && npm run _serve"
}
They are twins...
Solution
Using npm is a great solution for configuring, building, and other short processes. But for the product server, it is better to use node.js directly.
Top comments (0)