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
+31-21Lines changed: 31 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,14 +5,14 @@ services: static-web-apps
5
5
author: craigshoemaker
6
6
ms.service: azure-static-web-apps
7
7
ms.topic: how-to
8
-
ms.date: 08/29/2022
8
+
ms.date: 11/25/2024
9
9
ms.author: cshoe
10
10
ms.custom:
11
11
---
12
12
13
13
# Add an API to Azure Static Web Apps with Azure Functions
14
14
15
-
You can add serverless APIs to Azure Static Web Apps that are powered by Azure Functions. This article demonstrates how to add and deploy an API to an Azure Static Web Apps site.
15
+
You can add serverless APIs to Azure Static Web Apps powered by Azure Functions. This article demonstrates how to add and deploy an API to an Azure Static Web Apps site.
16
16
17
17
> [!NOTE]
18
18
> The functions provided by default in Static Web Apps are pre-configured to provide secure API endpoints and only support HTTP-triggered functions. See [API support with Azure Functions](apis-functions.md) for information on how they differ from standalone Azure Functions apps.
@@ -34,10 +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 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:
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, you can clone your repository using the `git` command line.
38
+
39
+
Before you run the following command, make sure to replace `<YOUR_GITHUB_USERNAME>` with your GitHub username.
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.
@@ -63,12 +65,12 @@ You create an Azure Functions project for your static web app's API. By default,
63
65
| Prompt | Value |
64
66
| --- | --- |
65
67
| Select a language |**JavaScript**|
66
-
| Select a programming model |**V3**|
68
+
| Select a programming model |**V4**|
67
69
| Provide a function name |**message**|
68
70
69
71
> [!TIP]
70
72
> You can learn more about the differences between programming models in the [Azure Functions developer guide](/azure/azure-functions/functions-reference)
71
-
73
+
72
74
An Azure Functions project is generated with an HTTP triggered function. Your app now has a project structure similar to the following example.
73
75
74
76
```Files
@@ -77,24 +79,31 @@ You create an Azure Functions project for your static web app's API. By default,
0 commit comments