Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative method for multiple servers #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,22 +194,18 @@ This utility will wait for maximum of 5 minutes while checking for the server to

### Starting two servers

Sometimes you need to start one API server and one webserver in order to test the application. Just have two commands cascade. First command should wait on the webserver script, which in turn uses `start-server-and-test` to start the API server before running the webserver. Something like this
Sometimes you need to start one API server and one webserver in order to test the application. We suggest using `concurrently` to simplify your scripts. We both start the servers and tell which ports to wait for.

```json
```
{
"scripts": {
"test": "node src/test",
"start:api": "node src/api",
"start:server": "node src/server",
"start:server-and-api": "start-test start:api 7600 start:server",
"test:all": "start-test start:server-and-api 5000 test"
"test:start-all": "concurrently 'node src/api' 'node/src/server'",
"test:all": "start-test test:start-all '5000|7600' test"
}
}
```

In the above example you would run `npm run test:all` to start both servers and run the test. See repo [start-two-servers-example](https://github.com/bahmutov/start-two-servers-example) for full example

### Small print

Author: Gleb Bahmutov <[email protected]> © 2017
Expand Down