When developing a web application we separate our application with *.web being initial server-side application and we provide a *.api application which will help us fetch/update data for client-side operations and avoid page reloads.
Here is .NET Core application I was working on which had a similar kind of ask, and I wanted to use VSCode to debug my application.
This is how we do it, first, we need to create a solution so that we keep both the API and Web project in one place
dotnet new sln -n appname
dotnet sln add src/appname/appname.web.csproj
dotnet sln add src/appname/apname.api.csproj
Open "launch.json" and Click on add configuration and add then select
.NET Core Launch (web)
No go ahead and rename to web or web-api, also add a development URL with a different than web configs the "env" property
Done now just run each of the configs with debug mode and happy debugging!
For reference adding the complete launch.json
Photo by Vincent van Zalinge on Unsplash
Originally blogged on Blogger