How did this kind of syntax become so popular? I think express is the first to do the scheme of: app.handleGet("/route/goes/here", (req, res) => { }); Which seems like it's useful for making really quick and dirty micro-services (nano-services, even), but I still vastly prefer the more declarative and modular schemes of bootstrap or asp.net: // Middleware automatically routes "/Foo" to FooController [Controller] publ…
Controller style declaration is often an overkill, it's also not exactly friendly to AOT. I personally prefer using MinApi style of declaration (first example). It can do request validation, model binding and inject services too: app.MapGet("/", async ( [FromBody] User user, [FromServices] MyService service) => { await service.Handle(user); return Results.Ok(); });
I also dislike functions and controllers without explicitly defined return types.