Skip to content

Commit 91273ac

Browse files
Merge pull request #274582 from adrianhall/swa/tutorial/react
Corrected problems with React tutorials
2 parents f14a1f9 + 7dfe1bf commit 91273ac

File tree

7 files changed

+44
-19
lines changed

7 files changed

+44
-19
lines changed

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

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,24 @@ You can add serverless APIs to Azure Static Web Apps that are powered by Azure F
2121

2222
- Azure account with an active subscription.
2323
- If you don't have an account, you can [create one for free](https://azure.microsoft.com/free).
24-
- [Visual Studio Code](https://code.visualstudio.com/)
25-
- [Azure Static Web Apps extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) for Visual Studio Code
26-
- [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) for Visual Studio Code
27-
- [Node.js](https://nodejs.org/download/) to run the frontend app and API
24+
- [Visual Studio Code](https://code.visualstudio.com/).
25+
- [Azure Static Web Apps extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) for Visual Studio Code.
26+
- [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions) for Visual Studio Code.
27+
- [Node.js v18](https://nodejs.org/en/download) to run the frontend app and API.
28+
29+
> [!TIP]
30+
> You can use the [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md) tool to manage multiple versions of Node.js on your development system.
31+
> On Windows, [NVM for Windows](https://github.com/coreybutler/nvm-windows/blob/master/README.md) can be installed via Winget.
2832
2933
## Create the static web app
3034

31-
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.
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+
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/my-username/my-first-static-web-app
41+
```
3242

3343
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.
3444

@@ -226,9 +236,12 @@ To run your frontend app and API together locally, Azure Static Web Apps provide
226236
Ensure you have the necessary command line tools installed.
227237

228238
```bash
229-
npm install -D @azure/static-web-apps-cli
239+
npm install -g @azure/static-web-apps-cli
230240
```
231241

242+
> [!TIP]
243+
> If you don't want to install the `swa` command line globally, you can use `npx swa` instead of `swa` in the following instructions.
244+
232245
### Build frontend app
233246

234247
If your app uses a framework, build the app to generate the output before running the Static Web Apps CLI.
@@ -266,7 +279,7 @@ npm run build
266279

267280
---
268281

269-
### Start the CLI
282+
### Run the application locally
270283

271284
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.
272285

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

307320
---
308321

309-
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. 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`.
310325

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

313328
## Add API location to workflow
314329

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

319334
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+
320345
1. Save the file.
321346

322347
## Deploy changes

articles/static-web-apps/deploy-angular.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ Select **Go to resource**.
107107
## Next steps
108108

109109
> [!div class="nextstepaction"]
110-
> [Configure app settings](./application-settings.yml)
110+
> [Add an API to your application](./add-api.md?tabs=angular)

articles/static-web-apps/deploy-react.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This article uses a GitHub template repository to make it easy for you to get st
2828

2929
[https://github.com/staticwebdev/react-basic/generate](https://github.com/login?return_to=%2Fstaticwebdev%2Freact-basic%2Fgenerate)
3030

31-
1. Name your repository **my-first-static-web-app**
31+
1. Name your repository **my-first-static-web-app**.
3232

3333
1. Select **Create repository from template**.
3434

@@ -107,4 +107,4 @@ Select **Go to resource**.
107107
## Next steps
108108

109109
> [!div class="nextstepaction"]
110-
> [Configure app settings](./application-settings.yml)
110+
> [Add an API to your application](./add-api.md?tabs=react)

articles/static-web-apps/deploy-vue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ Select **Go to resource**.
107107
## Next steps
108108

109109
> [!div class="nextstepaction"]
110-
> [Configure app settings](./application-settings.yml)
110+
> [Add an API to your application](./add-api.md?tabs=vue)

includes/static-web-apps/create-a-static-web-app.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ Now that the repository is created, you can create a static web app from the Azu
1212

1313
1. Navigate to the [Azure portal](https://portal.azure.com).
1414
1. Select **Create a Resource**.
15-
1. Search for **Static Web Apps**.
16-
1. Select **Static Web Apps**.
15+
1. Search for **Static Web App**.
16+
1. Select **Static Web App**.
1717
1. Select **Create**.
1818

1919
In the _Basics_ section, begin by configuring your new app and linking it to a GitHub repository.

includes/static-web-apps/static-web-apps-tutorials-portal-create.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Now that the repository is created, you can create a static web app from the Azu
1010

1111
1. Go to the [Azure portal](https://portal.azure.com).
1212
1. Select **Create a Resource**.
13-
1. Search for **Static Web Apps**.
14-
1. Select **Static Web Apps**.
13+
1. Search for **Static Web App**.
14+
1. Select **Static Web App**.
1515
1. Select **Create**.
1616

1717
::: zone pivot="github"

includes/static-web-apps/static-web-apps-tutorials-portal-view-website.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ The Static Web Apps *Overview* window displays a series of links that help you i
1616

1717
:::image type="content" source="../../articles/static-web-apps/media/getting-started/overview-window.png" alt-text="Screenshot of Azure Static Web Apps overview window.":::
1818

19-
1. Selecting on the banner that says, _Select here to check the status of your GitHub Actions runs_ takes you to the GitHub Actions running against your repository. Once you verify the deployment job is complete, then you can go to your website via the generated URL.
19+
1. Selecting _GitHub Action runs_ in the Overview takes you to the GitHub Actions running against your repository. Verify that the deployment action is complete before continuing.
2020

21-
1. Once GitHub Actions workflow is complete, you can select the _URL_ link to open the website in new tab.
21+
1. Once the GitHub Actions workflow is complete, you can select the _URL_ link to open the website in new tab.
2222

2323
::: zone-end
2424

0 commit comments

Comments
 (0)