I'm trying to use npm scripts as below:
"scripts": {
"test": "karma start karma.conf.js",
"prestart": "json-server --watch db.json",
"start": "http-server -a localhost -p 8000 -o -c-1"
},
I want to use prestart (json-server) before running start (http-server). But I'm only able to run one at a time. If I type npm start only json-server runs. Is it possible to run two servers in single command?
You could do something like this:
"scripts": {
"test": "karma start karma.conf.js",
"start-json": "json-server --watch db.json",
"start-http": "http-server -a localhost -p 8000 -o -c-1",
"start": "npm run start-json & npm run start-http"
},
Now npm start will run start-json and start-http concurrently.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With