Class NiteExtensions
- Namespace
- Nite
- Assembly
- Nite.dll
public static class NiteExtensions
- Inheritance
-
NiteExtensions
- Inherited Members
Methods
AddNite(IServiceCollection, Action<NiteOptions>?)
Registers Nite's services and tag helper dependencies.
public static IServiceCollection AddNite(this IServiceCollection services, Action<NiteOptions>? configure = null)
Parameters
servicesIServiceCollectionconfigureAction<NiteOptions>
Returns
MapNiteSpa(IEndpointRouteBuilder, string, string?, string?)
Serves an HTML entry from the client root (default index.html) for / and, as a
fallback, for any other path without a file extension, so client-side routes survive a
refresh. Real endpoints always win. Requests under apiPrefix never fall
back, so a mistyped API call gets a 404 instead of a page of HTML.
public static IEndpointConventionBuilder MapNiteSpa(this IEndpointRouteBuilder endpoints, string page = "index.html", string? apiPrefix = "/api", string? path = null)
Parameters
endpointsIEndpointRouteBuilderpagestringapiPrefixstringpathstringServe the page only under this path:
"/login"answers/loginand/login/…. An app can map several single-page apps this way, plus one without a path for everything else; the more specific path wins.
Returns
Remarks
In development the page is read from source on every request with the dev client injected;
in production it is the built copy from wwwroot/_nite.
UseNite(IApplicationBuilder)
In development, serves compiled modules, dependencies and the HMR socket under /_nite.
In production this does nothing: the build output is ordinary static files in wwwroot/_nite.
Call it before UseRouting/MapStaticAssets.
public static IApplicationBuilder UseNite(this IApplicationBuilder app)