Nano Web application.
Extends the API application with built-in support for Razor Pages and Blazor through registered services and middleware.
⚠️ Before proceeding, it is highly recommended to familiarize yourself generally with Nano Applications.
First install the Nano.App.Web NuGet package.
dotnet add package Nano.App.Web;Then, to create a NanoWebApplication simply add the following code to program.cs.
NanoWebApplication
.ConfigureApp()
.ConfigureServices(x =>
{
// Your services...
})
.Build<TRoot>()
.Run();Register your custom services in the ConfigureServices(x => { }) method to extend Nano with additional functionality or integrations.
Rather than wiring this up by hand, you can scaffold an already-configured, ready-to-deploy Web application in one command using the NanoCore.Templates
dotnet new template set.
| Template | Short Name | Description |
|---|---|---|
| Web Minimal | nanocore-web-minimal |
The Nano Web host (Razor/Blazor), Docker/Kubernetes deployment, and CI/CD - minimal configuration. |
dotnet new install NanoCore.Templates
dotnet new nanocore-web-minimal -n MyCompany.MyWeb -o .\MyCompany.MyWebThe App section in the configuration controls application-level behavior, similar to the API application.
Currently, the web application does not add any additional configuration options beyond those available in the API application.
📖 Learn more about Nano API Configuration.
Registers ASP.NET Core Razor Pages (AddRazorPages()/MapRazorPages()) and Razor Components (AddRazorComponents()/MapRazorComponents<TRoot>()) with interactive server-side rendering
(AddInteractiveServerComponents()/AddInteractiveServerRenderMode()) enabled by default. TRoot is the root component type passed to Build<TRoot>() when building the application.
Registers server-side Blazor (AddServerSideBlazor()) and maps its SignalR hub (MapBlazorHub()), so Blazor Server components run alongside Razor Pages/Components in the same application.
Both Razor and Blazor share the API application's existing ErrorHandling.ExposeErrors option to control whether detailed error information is surfaced (DetailedErrors), no additional
configuration is needed beyond what's already documented in Nano API Configuration.