NotFoundErrorHandler.ts 477 B

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