expressjs-structure
expressjs-structure copied to clipboard
MIddleware for controllers
Controllers here are written as bare functions, How could we apply different middlewares to each controllers depending on need?
This is useful when validating data fields that are only present in some of the controllers. Otherwise, we would need to explicitly declare an error return statement, which is prone to error.