Skip to content

Commit 008b484

Browse files
committed
docs: add guidance on connecting to a remote API host
1 parent 19c619b commit 008b484

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

docs/www/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Start the development server - this has built-in hot reload so you can preview c
1818

1919
```bash
2020
$ cd docs/www
21+
# If needed, run npm install to install dependencies.
22+
$ npm install
2123
$ npm start
2224
```
2325

docs/www/docs/cli/swa-start.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Here is a list of the default ports used by some popular dev servers:
5151
| [Next.js](https://nextjs.org/) | 3000 | `swa start http://localhost:3000` |
5252
| [React (Create React App)](https://reactjs.org/docs/create-a-new-react-app.html) | 3000 | `swa start http://localhost:3000` |
5353
| [Svelte (sirv-cli)](https://github.com/lukeed/sirv/tree/master/packages/sirv-cli/) | 5000 | `swa start http://localhost:5000` |
54-
| [Vue](https://github.com/vuejs/create-vue) | 3000 | `swa start http://localhost:3000` |
54+
| [Vue](https://github.com/vuejs/create-vue) | 3000 | `swa start http://localhost:3000` |
5555

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

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

7676
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.
7777

78-
#### Start the API server automatically
78+
#### Start the local API server automatically
7979

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

@@ -87,7 +87,7 @@ swa start ./my-dist --api-location ./api
8787
swa start http://localhost:3000 --api-location ./api
8888
```
8989

90-
#### Start API server manually
90+
#### Start local API server manually
9191

9292
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.
9393

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

103+
#### Connect to a remote API server
104+
105+
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.
106+
107+
```bash
108+
swa start http://localhost:3000 --api-location https://my-api-host.example.com
109+
```
110+
103111
## Options
104112

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

171+
Connect to a local front-end development server and a remote API server
172+
173+
```bash
174+
swa start http://localhost:3000 --api-location https://remote-api-host.example.com
175+
```
176+
163177
## See Also
164178

165179
- [swa](./swa)

0 commit comments

Comments
 (0)