

#App locale emulator code#
If Visual Studio Code doesn't generate a launch.json file for you, you can place the following configuration in. Visual Studio Code uses a file to enable debugging sessions in the editor.
#App locale emulator how to#
Now requests that go through port 4280 are routed to either the static content development server, or the API debugging session.įor more information on different debugging scenarios, with guidance on how to customize ports and server addresses, see the Azure Static Web Apps CLI repository. The Static Web Apps CLI is launched using both development servers. The Azure Functions API application is running a debug session in Visual Studio Code. The static content site is running via npm run dev.

The following screenshots show the terminals for a typical debugging scenario: swa start -api-location Replace with the development server's port number. Start the Static Web Apps CLI using the following command. Open the API application folder in Visual Studio Code and start a debugging session. This command is specific to the front-end framework you're using, but often comes in the form of commands like npm run build, npm start, or npm run dev. Start the static site development server. The following steps show you a common scenario that uses development servers for both debugging contexts. Local debugging is possible by allowing the Static Web Apps CLI to use development servers for one or both of these contexts. The first is for the static content site, and the second is for API functions. There are two debugging contexts in a static web app. Navigating to /.auth/logout clears the client principal and logs out the mock user. You can use the /.auth/me endpoint, or a function endpoint to retrieve the user's client principal. This value appears as the userDetails property in the client principal and is autogenerated if you don't provide a value.Ī list of role names, where each name is on a new line. The account name associated with the security provider. The emulator provides a page allowing you to provide the following client principal values: Value The emulator works with any security provider, not just GitHub. When a user logs in, you can define a fake identity profile returned to the app.įor instance, when you try to navigate to /.auth/login/github, a page is returned that allows you to define an identity profile.

The Static Web Apps CLI emulates the security flow implemented in Azure. output-folder -api-location Authorization and authentication emulation Swa start Start a Functions app in a folder Use a running framework development server Navigate to to view the app in the browser. Output folders are often named build or something similar. Run npm run build, or the equivalent command for your project.Ĭhange into the output directory for your app.
#App locale emulator install#
npm install -g azure-functions-core-toolsīuild your app if required by your application. Open a terminal to the root folder of your existing Azure Static Web Apps site.
