REST API Middleware

There are 2 kind of middlewares,

  • Global Middleware : All middleware files kept under ./server/middleware/ will be called for every api call.
  • Router Specific Middleware : These middleware files are kept under the respective router folder and will be called only for apis within that router.
    Example : router path - ./server/routers/primary/blog/blog.router.js
    and middleware file path - ./server/routers/primary/blog/blog.middleware.js

Each middleware is a subclass of BaseMiddleware and will have method called default. This method is mounted as a middleware.

Lifecycle Diagram


REST API



REST API - BelongsTo



REST API - BelongsTo


Subscribe to Our Newsletter

Let us stretch your imagination

Download App