Skip to content

Commit

Permalink
docs: add guidance on connecting to a remote API host
Browse files Browse the repository at this point in the history
  • Loading branch information
danwatford committed Oct 5, 2022
1 parent 19c619b commit 008b484
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/www/README.md
Expand Up @@ -18,6 +18,8 @@ Start the development server - this has built-in hot reload so you can preview c

```bash
$ cd docs/www
# If needed, run npm install to install dependencies.
$ npm install
$ npm start
```

Expand Down
20 changes: 17 additions & 3 deletions docs/www/docs/cli/swa-start.md
Expand Up @@ -51,7 +51,7 @@ Here is a list of the default ports used by some popular dev servers:
| [Next.js](https://nextjs.org/) | 3000 | `swa start http://localhost:3000` |
| [React (Create React App)](https://reactjs.org/docs/create-a-new-react-app.html) | 3000 | `swa start http://localhost:3000` |
| [Svelte (sirv-cli)](https://github.com/lukeed/sirv/tree/master/packages/sirv-cli/) | 5000 | `swa start http://localhost:5000` |
| [Vue](https://github.com/vuejs/create-vue) | 3000 | `swa start http://localhost:3000` |
| [Vue](https://github.com/vuejs/create-vue) | 3000 | `swa start http://localhost:3000` |

Instead of starting a dev server separately, you can provide the startup command to the CLI.

Expand All @@ -75,7 +75,7 @@ Then access the application with the emulated services from `http://localhost:42

If your project includes API functions, the CLI will check if the Azure Functions Core Tools are installed and available. If not, the CLI will download and install the right version of the Azure Functions Core Tools.

#### Start the API server automatically
#### Start the local API server automatically

Run the CLI and provide the folder that contains the API backend (a valid Azure Functions App project):

Expand All @@ -87,7 +87,7 @@ swa start ./my-dist --api-location ./api
swa start http://localhost:3000 --api-location ./api
```

#### Start API server manually
#### Start local API server manually

When developing your backend locally, sometimes it's useful to run Azure Functions Core Tools separately to serve your API. This allows you to use built-in features like debugging and rich editor support.

Expand All @@ -100,6 +100,14 @@ To use the CLI with your local API backend dev server, follow these two steps:
swa start ./my-dist --api-location http://localhost:7071
```

#### Connect to a remote API server

SWA CLI supports connecting to APIs hosted remotely, using services such as Azure and AWS. You can also connect to APIs hosted in a debug session in a GitHub Codespace.

```bash
swa start http://localhost:3000 --api-location https://my-api-host.example.com
```

## Options

Here are the options you can use with `swa start`:
Expand Down Expand Up @@ -160,6 +168,12 @@ Connect both front-end and the API to running development server
swa start http://localhost:3000 --api-location http://localhost:7071
```

Connect to a local front-end development server and a remote API server

```bash
swa start http://localhost:3000 --api-location https://remote-api-host.example.com
```

## See Also

- [swa](./swa)
Expand Down

0 comments on commit 008b484

Please sign in to comment.