Vulpix
Vulpix copied to clipboard
Middleware abstraction
A good thing to do would be the Middleware abstraction to increase the modularity of Vulpix.
In the current case, we create the middlewares and call the exec
method of the middleware. Example: app.Use(new BodyParser().Exec);
I guess what we could do is to create an interface, and all our middlewares would hinerit from this interface. So instead of giving the exec method, we'll give the concret middleware and work with the interface instead of the method.
yes may be, why i choose to do that it's that way you can easily create a middleware with a lambda method, as express do, you know what i mean? May be a good solution will be to integrate both, middleware using interface or just a function and in back we create the middleware with this function
Oh yes I see, you can create a middleware using lambda method:
app.Use(async (Req req, Res res) => {
// TODO
});
Could be interesting indeed to integrate both options like you said 😉
yes i think it will