How to use middleware and function in express?

kartik goyal
Feb 16, 2023

--

Middlewares — This type of functions should be independent of any other function. As they can be used as a layer inside the api. Can be used easily in multiple apis.

Functions — Can be dependent on other functions.

Basically try more to use middleware as compared to functions this helps more in defining the structure of any api as a collection of microsystem or layers.

Functions should be mostly used in creating utilities.

--

--

No responses yet