Alethic.Node.AspNetCore
1.0.1-pre.25
See the version list below for details.
dotnet add package Alethic.Node.AspNetCore --version 1.0.1-pre.25
NuGet\Install-Package Alethic.Node.AspNetCore -Version 1.0.1-pre.25
<PackageReference Include="Alethic.Node.AspNetCore" Version="1.0.1-pre.25" />
<PackageVersion Include="Alethic.Node.AspNetCore" Version="1.0.1-pre.25" />
<PackageReference Include="Alethic.Node.AspNetCore" />
paket add Alethic.Node.AspNetCore --version 1.0.1-pre.25
#r "nuget: Alethic.Node.AspNetCore, 1.0.1-pre.25"
#:package Alethic.Node.AspNetCore@1.0.1-pre.25
#addin nuget:?package=Alethic.Node.AspNetCore&version=1.0.1-pre.25&prerelease
#tool nuget:?package=Alethic.Node.AspNetCore&version=1.0.1-pre.25&prerelease
Alethic.Node.AspNetCore
Serve a JavaScript application's pages from ASP.NET Core, rendered on Node.js embedded in the process
(Alethic.Node). Published as Alethic.AspNetCore.Node through 0.3.
dotnet add package Alethic.Node.AspNetCore
dotnet add package Microsoft.JavaScript.LibNode.linux-x64 # the native runtime: one per platform you deploy to
Use
builder.Services.AddNodeEnginePool(o => o.EngineCount = 2);
var app = builder.Build();
app.UseStaticFiles();
app.UseRouting(); // explicit, or the fallback endpoint outruns static files
app.MapNodeFetchHandler(o =>
{
o.Module = NodeModuleSource.FromFile("ssr/app.cjs");
o.Environment["ApiBaseUri"] = "http://api.internal:8080/";
});
app.Run();
app.cjs is a CommonJS bundle whose default export has a fetch(request, env, ctx) function returning a Response,
or is one; Alethic.Node.Http says what it sees. The module loads
on every engine at startup. RequestBody and ResponseBody are Streamed unless set to Buffered.
An endpoint per route
MapNodeFetchHandler mounts one fallback endpoint. For an endpoint per route, write an INodeRouteProvider that
reads the application's own router, and pass it with the handler:
sealed class MyRouteProvider(NodeEnginePool pool, NodeModuleSource module) : INodeRouteProvider
{
public Task<IReadOnlyList<RenderRoute>> GetRoutesAsync(CancellationToken cancellationToken = default) =>
pool.RunAsync(module, exports => { /* read the routes out, as RenderRoutes */ }, cancellationToken);
}
app.MapNode(new FetchRequestHandler(pool, new() { Module = module }), new MyRouteProvider(pool, module));
A RenderRoute has a URLPattern Pattern (/parks/:parkRef), an Id that names the endpoint, and a RenderMode:
Server, Prerender, or Client, which is not mapped. MapNodeOptions.ConfigureEndpoint sees each endpoint, for
caching or authorization by route; FallbackPattern is the fallback, or null for none.
INodeRequestHandler (PrepareAsync, HandleAsync) is the seam for an application whose server protocol is not a
fetch handler.
Constraints
- Set
EngineCountto the cores the process may use; a container reports the host's. - Modules are CommonJS, bundled, without code splitting. A rebuilt bundle needs a restart.
- Module state is shared by every render on an engine.
- A streamed response cannot change its status after its first byte.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Alethic.Node.Http (>= 1.0.1-pre.25)
- System.IO.Pipelines (>= 9.0.0)
-
net9.0
- Alethic.Node.Http (>= 1.0.1-pre.25)
- System.IO.Pipelines (>= 9.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1-pre.27 | 52 | 10/4/2026 |
| 1.0.1-pre.25 | 55 | 10/4/2026 |
| 1.0.0 | 237 | 10/3/2026 |
| 1.0.0-pre.37 | 49 | 10/3/2026 |
| 1.0.0-pre.34 | 67 | 10/3/2026 |
| 1.0.0-pre.14 | 59 | 10/3/2026 |