2

I was working on one angular project. I was using JSON server to host the data. and to run, I use ng serve -o. and to run json server, I use json-server -p 3500 db.json. instead of using two terminals, Is there anyway I can run ng serve -o and automatically json server also starts to run?

WhiteShadow
  • 431
  • 2
  • 5
  • 1
    If you work with VS Code, you can configure a launch configuration inside of `launch.json` and use the property `preLaunchTask` to execute another command before the actual `ng serve` command. –  May 17 '22 at 08:20
  • You can create a custom script in your package.json. See this link https://stackoverflow.com/questions/58816737/is-it-possible-to-run-a-custom-script-before-ng-serve-and-before-live-reload-au – Den May 17 '22 at 08:48
  • Thanks for information Mike S . But I need to share this project to someone else. So changing in my VS code is not a solution for my problem. – WhiteShadow May 17 '22 at 08:50
  • 1
    You can use concurrently, like it was proposed here: https://stackoverflow.com/questions/30950032/how-can-i-run-multiple-npm-scripts-in-parallel – akkonrad May 17 '22 at 08:53

0 Answers0