Having a local development environment is important because it allows you to test your application in a controlled environment before deploying it to production. This way, you can catch and fix issues early on, without affecting your users. Additionally, local development allows you to experiment with new features and functionalities without worrying about breaking your production environment.
Being able to debug your application locally is also important because it allows you to quickly identify and fix issues early on, before they become bigger problems that could potentially ruin your project.
Now that you have a full-featured development environment based on devcontainer, you are able to run and debug your applications locally leveraging VSCode extensions capability and tools no matter which technology stack you are using. The ToDo app is based on React and .NET, but you can use the same approach to debug any application.
- Leveraging a dev container to debug your application.
- Debug an application inside a local devcontainer.
Debugging an application inside a devcontainer is a powerful feature of the Visual Studio Code Dev Containers extension. It allows you to debug your application in a containerized environment, which can be useful for testing and debugging your code in a consistent and isolated environment.
-
Configure Azure Credentials inside the devcontainer by signing into your Azure Account, using one of the following approaches:
- Using Azure CLI by running
az login
in terminal. - Using the Command Palette by running
Ctrl
+Shift
+P
and selecting Azure: Sign In. - Using Azure VSCode extension shortcut on left menu.
- Press the Azure icon.
- Select Sign In.
Azure Credentials - are used to authenticate with Azure when resources are running locally. The following applications will try to connect to Azure Key Vault and Cosmos DB.
- Using Azure CLI by running
-
Debug API application.
- Generate a developer certificate by running
dotnet dev-certs https
in the terminal. - Press
Ctrl
+Shift
+D
to open the Debug view. - Select Debug API.
- Go to https://localhost:3101/index.html and review the available Swagger API.
- Generate a developer certificate by running
-
Run Web application:
- Build and Run the React based web application via VSCode task, Menu -> Terminal -> Run Task -> Start Web, it might take few minutes.
- Go to https://localhost:3000.
Name | Description |
---|---|
Visual Studio Code User Interface | VSCode user interface documentation |