import { Middleware, StatusCodes, Request, Response, NextFunction } from '../base/http';
import { $$ } from '../base/i18n';
import { MiddlewareOrder } from './MiddlewareOrder';

class NotFoundErrorHandler extends Middleware {
	protected order = MiddlewareOrder.NotFoundErrorHandler;
	protected route = null;
	protected action = (req: Request, res: Response, next: NextFunction): any => {
		res.status(StatusCodes.NOT_FOUND).send($$('org.crazydoctor.expressts.httpError.404', { url: req.url }));
	};
}

export { NotFoundErrorHandler };