@opra/nestjs-http
Version:
Opra NestJS Http Module
22 lines (21 loc) • 798 B
TypeScript
import { type NestMiddleware } from '@nestjs/common';
import type { NextFunction, Request, Response } from 'express';
import { OpraHttpNestjsAdapter } from './opra-http-nestjs-adapter.js';
/**
* OpraMiddleware
*
* NestJS middleware that creates an OPRA context (HttpContext) for each HTTP request
* and adds it to the request.
*/
export declare class OpraMiddleware implements NestMiddleware {
protected opraAdapter: OpraHttpNestjsAdapter;
constructor(opraAdapter: OpraHttpNestjsAdapter);
/**
* Processes requests and creates the OPRA context.
*
* @param req - Express request object.
* @param res - Express response object.
* @param next - Function that calls the next middleware.
*/
use(req: Request, res: Response, next: NextFunction): void;
}