You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/static-web-apps/add-api.md
+22-3Lines changed: 22 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,12 @@ You can add serverless APIs to Azure Static Web Apps that are powered by Azure F
34
34
35
35
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.
36
36
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:
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.
38
44
39
45
```Files
@@ -233,6 +239,7 @@ Ensure you have the necessary command line tools installed.
233
239
npm install -g @azure/static-web-apps-cli
234
240
```
235
241
242
+
> [!TIP]
236
243
>Ifyoudon't want to install the `swa` command line globally, you can use `npx swa` instead of `swa` in the following instructions.
237
244
238
245
### Buildfrontendapp
@@ -272,7 +279,7 @@ npm run build
272
279
273
280
---
274
281
275
-
### StarttheCLI
282
+
### Runtheapplicationlocally
276
283
277
284
RunthefrontendappandAPItogetherbystartingtheappwiththeStaticWebAppsCLI. RunningthetwopartsofyourapplicationthiswayallowstheCLItoserveyourfrontend's build output from a folder, and makes the API accessible to the running app.
278
285
@@ -312,9 +319,11 @@ Run the frontend app and API together by starting the app with the Static Web Ap
312
319
313
320
---
314
321
315
-
1.WhentheCLIprocessesstart, accessyourappat`http://localhost:4280/`. NoticehowthepagecallstheAPIanddisplaysitsoutput, `Hello from the API`.
0 commit comments