Skip to content

mrahhal/MR.AspNetCore.NestedRouting

Repository files navigation

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages