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
Optionally, if you use the `swa init` command, the Static Web Apps CLI looks at your application code and build a _swa-cli.config.json_ configuration file for the CLI. When you use the _swa-cli.config.json_ file, you can run `swa start` to launch your application locally.
63
+
64
+
<sup>1</sup> The Azure Functions Core Tools are automatically installed by the CLI if they are not already on your system.
65
+
62
66
## Prerequisites
63
67
64
68
-**Existing Azure Static Web Apps site**: If you don't have one, begin with the [vanilla-api](https://github.com/staticwebdev/vanilla-api/generate?return_to=/staticwebdev/vanilla-api/generate) starter app.
65
69
-**[Node.js](https://nodejs.org) with npm**: Run the [Node.js LTS](https://nodejs.org) version, which includes access to [npm](https://www.npmjs.com/).
66
70
-**[Visual Studio Code](https://code.visualstudio.com/)**: Used for debugging the API application, but not required for the CLI.
67
-
-**[Azure Functions Core Tools](https://github.com/Azure/azure-functions-core-tools#installing)**: Required to run the API locally.
68
71
69
72
## Get started
70
73
@@ -73,14 +76,20 @@ Open a terminal to the root folder of your existing Azure Static Web Apps site.
1. Build your app if required by your application.
80
83
81
84
Run `npm run build`, or the equivalent command for your project.
82
85
83
-
1. Change into the output directory for your app. Output folders are often named _build_ or something similar.
86
+
1. Initialize the repository for the CLI.
87
+
88
+
```console
89
+
swa init
90
+
```
91
+
92
+
Answer the questions posed by the CLI to verify your configuration settings are correct.
84
93
85
94
1. Start the CLI.
86
95
@@ -92,12 +101,12 @@ Open a terminal to the root folder of your existing Azure Static Web Apps site.
92
101
93
102
### Other ways to start the CLI
94
103
95
-
| Description | Command |
96
-
|--- | --- |
97
-
| Serve a specific folder | `swa start ./output-folder` |
98
-
| Use a running framework development server | `swa start http://localhost:3000` |
99
-
| Start a Functions app in a folder | `swa start ./output-folder --api-location ./api` |
100
-
| Use a running Functions app | `swa start ./output-folder --api-location http://localhost:7071` |
104
+
| Description | Command | Comments |
105
+
|--|--|--|
106
+
| Serve a specific folder | `swa start ./<OUTPUT_FOLDER_NAME>` | Replace `<OUTPUT_FOLDER_NAME>` with the name of your outputfolder. |
107
+
| Use a running framework development server | `swa start http://localhost:3000` | This command works when you have an instance of your application running under port `3000`. Update the port number if your configuration is different. |
108
+
| Start a Functions app in a folder | `swa start ./<OUTPUT_FOLDER_NAME> --api-location ./api` | Replace `<OUTPUT_FOLDER_NAME>` with the name of your output folder. This command expects your application's API to have files in the _api_ folder. Update this value if your configuration is different. |
109
+
| Use a running Functions app | `swa start ./<OUTPUT_FOLDER_NAME> --api-location http://localhost:7071` | Replace `<OUTPUT_FOLDER_NAME>` with the name of your output folder. This command expects your Azure Functions application the be available through port `7071`. Update the port number if your configuration is different. |
101
110
102
111
## Authorization and authentication emulation
103
112
@@ -136,12 +145,11 @@ The following steps show you a common scenario that uses development servers for
136
145
137
146
1. Start the Static Web Apps CLI using the following command.
0 commit comments