This samples demonstrates how to integrate an ASP.NET Core API with a Nuxt front end.
This repository is composed of 3 parts:
- a basic ASP.NET Core API (in the
WebApifolder) created from the .NET 9webapitemplate - a simple Nuxt front end (in the
WebAppfolder) created from thev4-compattemplate - a .NET Aspire project (in the
AppHostfolder) to orchestrate theWebAppandWebApiprojects
This blog article explains how this repository was created.
Before running the application, make sure to have configured HTTPS as explained in this article:
- Create an
.envfile with the following content:
NODE_TLS_REJECT_UNAUTHORIZED=0
- Generate and trust the ASP.NET Core HTTPS Development certificate if you haven't already:
dotnet dev-certs https --trust- Create the certificate and private key files for the Nuxt front end:
dotnet dev-certs https --export-path ./WebApp/dev-cert.pem --format PEM -npAdd the URL of the API in your .env file:
ApiUrl=https://localhost:7238
To run the application, you need to start both the API and the front
// Launch the ASP.NET Core API
dotnet run --project WebApi\WebApi.csproj// Launch the Nuxt application front end
pnpm --dir WebApp devTo run the application with .NET Aspire, you need to start the AppHost project:
dotnet run --project AppHost/AppHost.csproj