Naravel.Routing 0.2.0

dotnet add package Naravel.Routing --version 0.2.0
                    
NuGet\Install-Package Naravel.Routing -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Naravel.Routing" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Naravel.Routing" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Naravel.Routing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Naravel.Routing --version 0.2.0
                    
#r "nuget: Naravel.Routing, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Naravel.Routing@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Naravel.Routing&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Naravel.Routing&version=0.2.0
                    
Install as a Cake Tool

Naravel.Routing

NuGet Downloads .NET 10 License: MIT

Laravel-style routing and middleware for ASP.NET Core: fluent route groups, named routes, route model binding, resource routes and a middleware engine with aliases, groups, parameters, priority, withoutMiddleware and terminable middleware.

Fact Detail
Install dotnet add package Naravel.Routing
Targets .NET 10
Needs ASP.NET Core (the Microsoft.AspNetCore.App shared framework) and no other Naravel package
Add-on Naravel.Routing.Cache shares the throttle quota between application instances

What you get

  • Fluent routes on Minimal APIs. Groups (Prefix, Name, Domain, Middleware), named routes with a URL generator, Where constraints, resource routes and route model binding.
  • Mistakes fail at startup. Nothing is mapped until the MapNaravel callback returns, so the order of Name, Where and Middleware does not matter, and a Where for a parameter that is not in the URI throws when the application starts.
  • Ready-made middleware. throttle, signed, maintenance, cache.headers, trim, convert.empty and guest; your own IRouteMiddleware classes register under an alias.
  • A throttle that scales out. It counts in the process by default, and Naravel.Routing.Cache makes every instance share one count.
  • Easy to test. A route middleware is a plain class you can call without a host, and TestServer runs the real pipeline in memory.

Quick start

using Naravel.Routing;

builder.Services.AddNaravelRouting(o =>
{
    o.Middleware.Alias<EnsureTenant>("tenant");   // EnsureTenant is your own route middleware, shown below
    o.ConfigureThrottlePolicy("login", 5, TimeSpan.FromMinutes(1));
});

app.UseNaravelRouting();   // runs the route middleware; if you call UseRouting() yourself, call this after it

app.MapNaravel(r =>
{
    r.Get("/", () => "home").Name("home");
    r.Post("/login", () => Results.Ok()).Middleware("throttle:login");

    r.Prefix("api").Middleware("tenant").Group(api =>
    {
        api.Get("orders/{id}", (int id) => Results.Ok(id)).Where("id", "[0-9]+").Name("orders.show");
    });
});

public sealed class EnsureTenant : IRouteMiddleware
{
    public async Task InvokeAsync(HttpContext context, RequestDelegate next, MiddlewareArguments arguments)
    {
        if (!context.Request.Headers.ContainsKey("X-Tenant"))
        {
            context.Response.StatusCode = StatusCodes.Status400BadRequest;   // short-circuit
            return;
        }

        await next(context);
    }
}

There is no built-in auth middleware, so register your own with o.Middleware.Alias.

throttle counts attempts in the process by default, so with several instances each one has its own count. To share one count, add the Naravel.Routing.Cache package and call services.AddNaravelSharedThrottle("shared"), where "shared" is the name of a Naravel.Cache store that every instance uses (a Redis or Memcached store; a Memory store is still per process). The routing guide shows the full setup. A request over the limit gets a 429 response.

Package Adds
Naravel.Routing.Cache A throttle store that every application instance shares, counting in a Naravel.Cache store such as Redis

Learn more

Part of Naravel: Laravel's names, .NET's type system. All Naravel packages share one version.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Naravel.Routing:

Package Downloads
Naravel.Routing.Cache

A shared store for the Naravel.Routing throttle middleware, counting in a Naravel.Cache store (for example Redis) so every application instance uses one quota.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 290 11/13/2026
0.1.1 106 11/2/2026
0.1.0 105 11/1/2026