Skip to content

Commit 93dc923

Browse files
author
Adrian Hall
committed
Small changes to add-api
1 parent a7c76f0 commit 93dc923

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

articles/static-web-apps/add-api.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ You can add serverless APIs to Azure Static Web Apps that are powered by Azure F
3434

3535
Before adding an API, create and deploy a frontend application to Azure Static Web Apps. Use an existing app that you've already deployed or create one by following the [Building your first static site with Azure Static Web Apps](getting-started.md) quickstart.
3636

37+
Once you have a frontend application deployed to Azure Static Web Apps, [clone your app repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository). For example, to clone using the `git` command line:
38+
39+
```bash
40+
git clone https://github.com/_username_/my-first-static-web-app
41+
```
42+
3743
In Visual Studio Code, open the root of your app's repository. The folder structure contains the source for your frontend app and the Static Web Apps GitHub workflow in _.github/workflows_ folder.
3844

3945
```Files
@@ -233,6 +239,7 @@ Ensure you have the necessary command line tools installed.
233239
npm install -g @azure/static-web-apps-cli
234240
```
235241

242+
> [!TIP]
236243
> If you don't want to install the `swa` command line globally, you can use `npx swa` instead of `swa` in the following instructions.
237244

238245
### Build frontend app
@@ -272,7 +279,7 @@ npm run build
272279

273280
---
274281

275-
### Start the CLI
282+
### Run the application locally
276283

277284
Run the frontend app and API together by starting the app with the Static Web Apps CLI. Running the two parts of your application this way allows the CLI to serve your frontend's build output from a folder, and makes the API accessible to the running app.
278285

@@ -312,9 +319,11 @@ Run the frontend app and API together by starting the app with the Static Web Ap
312319

313320
---
314321

315-
1. When the CLI processes start, access your app at `http://localhost:4280/`. Notice how the page calls the API and displays its output, `Hello from the API`.
322+
1. Windows Firewall may prompt to request that the Azure Functions runtime can access the Internet. If this happens, select **Allow**.
323+
324+
2. When the CLI processes start, access your app at `http://localhost:4280/`. Notice how the page calls the API and displays its output, `Hello from the API`.
316325

317-
1. To stop the CLI, type <kbd>Ctrl + C</kbd>.
326+
3. To stop the CLI, type <kbd>Ctrl + C</kbd>.
318327

319328
## Add API location to workflow
320329

@@ -323,6 +332,16 @@ Before you can deploy your app to Azure, update your repository's GitHub Actions
323332
1. Open your workflow at _.github/workflows/azure-static-web-apps-\<DEFAULT-HOSTNAME>.yml_.
324333

325334
1. Search for the property `api_location` and set the value to `api`.
335+
336+
```yaml
337+
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
338+
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
339+
app_location: "/" # App source code path
340+
api_location: "api" # Api source code path - optional
341+
output_location: "build" # Built app content directory - optional
342+
###### End of Repository/Build Configurations ######
343+
```
344+
326345
1. Save the file.
327346

328347
## Deploy changes

0 commit comments

Comments
 (0)