Reputation: 19
how can I start both this only by typing npm start?
"scripts"{
"server": "json-server --watch appointmentList.json",
"start": "react-scripts start",
}
what i've been doing was running each of them in different terminal
Upvotes: 1
Views: 972
Reputation: 2558
You could use '&&' like:
{
"server": "json-server --watch appointmentList.json",
"start": "npm run server && react-scripts start"
}
Upvotes: 1
Reputation: 1066
In short, you can append the desired commands to the start
script:
"scripts": {
"server": "json-server --watch appointmentList.json",
"start": "json-server --watch appointmentList.json && react-scripts start"
}
and call it with $npm run start
or $npm start
Upvotes: 2
Reputation: 2143
you can install concurrently
to run the scripts in parallel, like this:
{
"dev": "concurrently \"npm run server\" \"npm start\""
}
Upvotes: 5