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
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ ms.author: wachegha
13
13
14
14
You can add serverless APIs to Azure Static Web Apps via integration with Azure Functions. This article demonstrates how to add and deploy an API to an Azure Static Web Apps site.
15
15
16
+
For information about how to secure API routes, refer to the [routing guide](routes.md).
17
+
16
18
## Prerequisites
17
19
18
20
- Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free).
Copy file name to clipboardExpand all lines: articles/static-web-apps/routes.md
+7-24Lines changed: 7 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,29 +36,7 @@ The following table lists the appropriate location to put your _routes.json_ fil
36
36
37
37
### Angular
38
38
39
-
Angular apps do not copy files in the _src_ folder to the artifact folder by default. You can point the GitHub Actions workflow directly to your _routes.json_ file via the [`routes_location` workflow customization](github-actions-workflow.md#route-file-location), or you can update the _angular.json_ file to copy the file.
40
-
41
-
Using the `routes_location` customization is preferred, but you can also use the following steps update the _angular.json_ file.
42
-
43
-
1. In Visual Studio Code, open the _angular.json_ file
44
-
1. Go to the property at:
45
-
46
-
```schema
47
-
projects
48
-
└── <ANGULAR_APP_NAME>
49
-
└── architect
50
-
└── build
51
-
└── options
52
-
└── assets
53
-
```
54
-
55
-
1. Extend the `assets` array to include the _src/routes.json_ file:
Now Angular is configured to copy the _routes.json_ file to your artifact location when your app builds.
39
+
Angular apps do not copy all the files in the _src_ folder to the artifact folder by default. To ensure the _routes.json_ file is copied to the correct location, point the GitHub Actions workflow directly to your _routes.json_ file via the [`routes_location` workflow customization](github-actions-workflow.md#route-file-location).
62
40
63
41
## Defining routes
64
42
@@ -185,7 +163,7 @@ The following table lists the available platform error overrides:
185
163
186
164
## Example route file
187
165
188
-
The following example shows how to build route rules in a _routes.json_ file. Some routes use the [_/.auth_ system folder](authentication-authorization.md) that access authentication-related endpoints.
166
+
The following example shows how to build route rules for static content and APIs in a _routes.json_ file. Some routes use the [_/.auth_ system folder](authentication-authorization.md) that access authentication-related endpoints.
189
167
190
168
```json
191
169
{
@@ -198,6 +176,10 @@ The following example shows how to build route rules in a _routes.json_ file. So
@@ -243,6 +225,7 @@ The following examples describe what happens when a request matches a rule.
243
225
|---------|---------|---------|
244
226
|_/profile_| Authenticated users are served the _/profile/index.html_ file. Unauthenticated users redirected to _/login_. |
245
227
|_/admin/reports_| Authenticated users in the _administrators_ role are served the _/admin/reports/index.html_ file. Authenticated users not in the _administrators_ role are served a 401 error<sup>1</sup>. Unauthenticated users redirected to _/login_. |
228
+
|_/api/admin_| Requests from authenticated users in the _administrators_ role are sent to the API. Authenticated users not in the _administrators_ role and unauthenticated users are served a 401 error. |
246
229
|_/customers/contoso_| Authenticated users who belong to either the _administrators_ or _customers\_contoso_ roles are served the _/customers/contoso/index.html_ file<sup>1</sup>. Authenticated users not in the _administrators_ or _customers\_contoso_ roles are served a 401 error. Unauthenticated users redirected to _/login_. |
247
230
|_/login_| Unauthenticated users are challenged to authenticate with GitHub. |
248
231
|_/.auth/login/twitter_| Authorization with Twitter is disabled. The server responds with a 404 error. |
0 commit comments