Skip to content

Latest commit

 

History

History
71 lines (53 loc) · 3.67 KB

File metadata and controls

71 lines (53 loc) · 3.67 KB

Nano.App.Web

Build and Deploy NuGet NuGet

Nano Web application.


Table of Contents

Summary

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.

Registration

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.MyWeb

Configuration

The 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.

Razor

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.

Blazor

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.