Convention based route builder
See original GitHub issueI have another suggestion - which I can help you implement.
The idea would be to have an option to activate a convention based route builder. This means that you don’t have to specify your route if you want it to follow the namespace in which you are working.
From your same Web application:
namespace Customers.List.Recent;
public class Endpoint : EndpointWithoutRequest
{
public override void Configure()
{
Verbs(Http.GET);
Routes("/customer/list/recent");
}
}
So basically the Routes
can be build automatically using the namespace.
You would still be able to set (additional) routes manually if you choose for this convention based option.
In this option you can add “ignore” words (for example, if your namespace would contain MyCompany.Features.Customers.List.Recent you could add “MyCompany” and “Features” as ignore words).
Furthermore you could decide on formatting: lower-case, pascal-wording, etc.
Inventory.GetProduct
-> inventory/get-product
for example.
Again, this would be totally optional as all the rest and I don’t think it would affect performance when building the routes.
What do you think? Would it be an idea to add (I can make a PR if you want). If you don’t like it, or think the lib we be “too much” just say 😃
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top GitHub Comments
Okay understood! No problem. I can easily add it for my own project in base classes. So I am good.
good stuff 😃