Thursday 10 August 2017

[Question] Atomic middleware in Express a bad idea?

The problem is this:I'd like to reuse my server-side code as much as possible (duh). I have seen many people suggest using "controllers" for all business logic, and leveraging the express middleware as just a way to direct traffic to different functions on the controllers. This is the swagger.io philosophy.Okay sure, I get that, but would it be such a bad idea to make each express middleware atomic (one small isolated piece of functionality) and simply call the middleware manually while passing req,res, and next to it? It is essentially the same concept without the need for quite as much abstraction.Any thoughts are appreciated.

Submitted August 11, 2017 at 12:51AM by LionaltheGreat

No comments:

Post a Comment