Closed neville-nazerane closed 5 years ago
@JamesNK This looks like Endpoints. Want to show them your progress?
That's exactly what we are working on for 3.0.
Disclaimer: This is very early and 3.0 work and will not be RTM until well into next year.
Tracked elsewhere. Closing this one.
It would be nice some extension functions for
IApplicationBuilder
likeUseGet()
orUseHttpGet()
that could add a middleware that directly matches to HTTP GET and to the specified path (similarly for POST, PUT and DELETE). It could be helpful in small web apps for adding some simple middlewares quick and with a high performance. I was planning to make a PR for the same with unit tests and I had to check if this makes sense. I had planned something similar to the following overloads forUseGet()
,UsePost()
,UsePut()
andUseDelete()
:UseGet(PathString path, string responseText)
: On matching the path and method, printsresponseText
with HTTP OKUseGet(PathString path, Action<HttpContext> middleware)
: On matching the path and method, passes the context tomiddleware
.UseGet(PathString path, Func<HttpContext, Task> middleware)
: Async variant of the above.UseGet(PathString path, Func<HttpContext, Func<Task>, Task> middleware)
: On matching the path and method, passes the context and next delegate tomiddleware
.