4

I have created an Angular app. I have created mock server using json-server plugin from node.

Currently problem with this is, I have to open multiple command prompt to run json server and angular cli.

Is there any way where I can execute both the commands in parallel. OR is there any way where I will run ng serve and in behind it runs the json-server command as well?

1
  • 1
    You could add a script to your package file that uses e.g. concurrently to run both commands (see e.g. github.com/textbook/salary-stats/blob/…). But this is really nothing to do with Angular generally or the CLI specifically. Commented Sep 28, 2017 at 12:45

1 Answer 1

7

You can try to use the package called concurrently.

npm install concurrently --save-dev

Then setup your package.json scripts:

"start": "concurrently --kill-others \"npm run server\" \"ng serve\""

or on unix systems without the library

"start": "npm run server | ng serve"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.