NotFoundErrorHandler.ts 530 B

12345678910111213
  1. import { Middleware, StatusCodes, Request, Response, NextFunction } from '../base/http';
  2. import { $ } from '../base/i18n';
  3. import { MiddlewareOrder } from './MiddlewareOrder';
  4. class NotFoundErrorHandler extends Middleware {
  5. protected order = MiddlewareOrder.NotFoundErrorHandler;
  6. protected route = null;
  7. protected action = (req: Request, res: Response, next: NextFunction): any => {
  8. res.status(StatusCodes.NOT_FOUND).send($('org.crazydoctor.extress.httpError.404', { url: req.url }));
  9. };
  10. }
  11. export { NotFoundErrorHandler };