Goodrouter 1.0.6

.NET 6.0
dotnet add package Goodrouter --version 1.0.6
NuGet\Install-Package Goodrouter -Version 1.0.6
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="Goodrouter" Version="1.0.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Goodrouter --version 1.0.6
#r "nuget: Goodrouter, 1.0.6"
#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.
// Install Goodrouter as a Cake Addin
#addin nuget:?package=Goodrouter&version=1.0.6

// Install Goodrouter as a Cake Tool
#tool nuget:?package=Goodrouter&version=1.0.6

GoodRouter, .NET edition

Check out the website, join our Discord server!

Example:

var router = new Router();

router
    .InsertRoute("all-products", "/product/all")
    .InsertRoute("product-detail", "/product/{id}");

// And now we can parse routes!

{
    var (routeKey, routeParameters) = router.ParseRoute("/not-found");
    Assert.Null(routeKey);
    Assert.Equal(
        new Dictionary<string, string>(),
        routeParameters
    );
}

{
    var (routeKey, routeParameters) = router.ParseRoute("/product/all");
    Assert.Equal("all-products", routeKey);
    Assert.Equal(
        new Dictionary<string, string>(),
        routeParameters
    );
}

{
    var (routeKey, routeParameters) = router.ParseRoute("/product/1");
    Assert.Equal("product_detail", routeKey);
    Assert.Equal(
        new Dictionary<string, string>() {
            {"id", "1"}
        },
        routeParameters
    );
}

// And we can stringify routes

{
    var path = router.StringifyRoute("all-products");
    Assert.Equal("/product/all", path);
}

{
    var path = router.StringifyRoute(
        "product-detail",
        new Dictionary<string, string>() {
            {"id", "2"}
        }
    );
    Assert.Equal("/product/2", path);
}

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android 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. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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.6 67 11/7/2023
1.0.0 331 3/10/2023
0.3.6 331 3/9/2023
0.2.0 388 2/5/2023
0.1.3 360 2/1/2023
0.1.2 340 2/1/2023
0.1.1 339 2/1/2023
0.1.0 351 1/31/2023
0.0.19 348 1/29/2023
0.0.18 373 1/29/2023
0.0.17 361 1/29/2023
0.0.16 366 1/29/2023
0.0.15 369 1/29/2023
0.0.14 326 1/29/2023
0.0.12 342 1/28/2023
0.0.10 363 1/28/2023
0.0.9 353 1/28/2023
0.0.8 347 1/28/2023
0.0.7 347 1/27/2023
0.0.5 393 1/27/2023
0.0.1 422 1/27/2023