Nest: [Suggestion] Adding Middleware Pipeline

Created on 7 Nov 2017  路  5Comments  路  Source: nestjs/nest

What is a Middleware Pipeline ?

For now all Middleware run in sequence

Client => Middleware1 => Middleware2 => Middleware3 => Server (Controller)

What's Middleware Pipeline is to create a pipeline that will make Middleware run in parallel , WHAT ?

                | => (Pipeline) [Middleware1 => Middleware2]
Client =>
                | => (Pipeline) [Middleware3]

Why Pipelines ?

80% of the middleware are not dependent upon each other, so executing them in sequence is overkill
Making them parallel will be huge performance boost.
What I have in mind is.. Piplelines + Middleware
Each pipeline will be executed in sequence and it can have multiple middleware, they will be executed in parallel
So If u want 2 middleware to be executed in sequence, you can put them in 2 pipelines
So middleware like聽Shield + Flash + AuthInitwill be in a single pipeline
And聽Cors聽will be in a different pipeline, since it has the ability to end the request of it鈥檚 own.
@thetutlage "the Author of AdonisJS"

You can read more at this Discussion in AdonisJS Framework

All 5 comments

馃憤

@adrien2p Please use reactions instead, these comments really pollutes issues so is this one I'm writing.

Express is written asynchronously to handle middlewares as a pipeline, and this is just a more literal expression of how Express handles middlewares.

I will try to see it anyway

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mishelashala picture mishelashala  路  3Comments

rlesniak picture rlesniak  路  3Comments

VRspace4 picture VRspace4  路  3Comments

hackboy picture hackboy  路  3Comments

FranciZ picture FranciZ  路  3Comments