Karim Walid
Karim Walid

Reputation: 83

How to make a node.js server run with a specific command

I want to start my index.js file with node --max-old-space-size=1024 index.js but I don't want to type the command manually everytime, any Idea how can I make a .js file that executes the command for me? Like start.js and when I launch it, it immediately runs node --max-old-space-size=1024 index.js. This might be super straight forward but I'm still new to node.js 😅

Upvotes: 0

Views: 310

Answers (1)

J.F.
J.F.

Reputation: 15225

You can modify your package.json to create a command that execute node --max-old-space-size=1024 index.js

In your package.json

"scripts": {
  "start": "node --max-old-space-size=1024 index.js"
}

And then run npm run start.

Upvotes: 3

Related Questions