C
C#2y ago
Thinker

❔ ✅ Is middleware considered a pattern?

I'm working on a little toy project, and I want to implement a kind of "middleware" into it. However, other than ASP.NET, I'm having a hard time finding resources about implementing middleware as a pattern. Is middleware considered a "pattern", or is it just something that exists in ASP.NET and not really anywhere else else? Are there any decent resources about implementing it into applications?
7 Replies
Henkypenky
Henkypenky2y ago
you mean a design pattern? it's not specific to .NET by any means it's just software that goes in the middle of the initial request and final response to do stuff that can help you better tailor your app let's start by understanding the asp.net core pipeline https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/?view=aspnetcore-7.0
Henkypenky
Henkypenky2y ago
Henkypenky
Henkypenky2y ago
now there are a lot of built-in middleware, like authorization, authentication, etc
Henkypenky
Henkypenky2y ago
Henkypenky
Henkypenky2y ago
here you can see the ordering (which matters) in the pipeline the middleware you want to implement is considered custom so it should go at the very end, before hitting the endpoint once it hits the endpoint it starts working itself backwards to produce the response this can give you a jump start to write your own https://learn.microsoft.com/en-us/aspnet/core/fundamentals/middleware/write?view=aspnetcore-7.0 and work from there
Thinker
Thinker2y ago
right, thanks
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server