mrahhal / MR.AspNetCore.NestedRouting

Nested routing for Asp.Net Core.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MR.AspNetCore.NestedRouting

AppVeyor Travis
Build status Travis

NuGet version License

Nested routing for Asp.Net Core.

Overview

Enables writing nested controllers as a way to better model how api routes look.

Getting started

Configuration

public void ConfigureServices(IServiceCollection services)
{
    services
        .AddMvc()
        .AddNestedRouting();
}

You can also enable using kebab casing for routes:

public void ConfigureServices(IServiceCollection services)
{
    services
        .AddMvc()
        .AddNestedRouting(useKebabCase: true);
}

There is also a ControllerNameAttribute you can use to override controller names:

[ControllerName("bazzzzzz")]
public class BazController : SomeBaseController
{
}

MvcPack

Using this together with MvcPack will give you a great way for organizing your controllers.

Samples

  • Basic: implements nested routing in an Asp.Net Core app (has a swagger ui that you can open so as to inspect the routes).

About

Nested routing for Asp.Net Core.

License:MIT License


Languages

Language:C# 70.0%Language:PowerShell 29.0%Language:Shell 0.8%Language:CoffeeScript 0.2%