express-rest-decorators - v1.0.0-rc.2
    Preparing search index...

    Function useExpressControllers

    • Mount controllers on an existing Express v5 app. Body parsing is the caller's responsibility — this function does NOT install express.json().

      Mounting order:

      1. Global @Middleware({type:'before'}) and function-form entries → app.use(...)
      2. One express.Router() per controller → app.use(mountPath, router)
      3. Global @Middleware({type:'after'}) non-error instances → app.use(...)
      4. User error middleware (4-arg use) → app.use(errorHandler) [if defaultErrorHandler !== false]
      5. libraryErrorMiddleware → app.use(libraryErrorMiddleware) [if defaultErrorHandler !== false]

      Async because:

      • Container.get() may return a Promise
      • Arity detection for user error middleware requires resolving the class at boot
      • Global interceptor resolution happens once before the controller loop

      Parameters

      Returns Promise<Express>

      Promise — the same app, for chaining.