Phase 1: Backend skeleton (Express, MongoDB, config, error middleware, health)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { ApiError } from '../utils/ApiError.js';
|
||||
|
||||
import type { NextFunction, Request, Response } from 'express';
|
||||
|
||||
/**
|
||||
* Middleware для маршрутов, которых не существует.
|
||||
*
|
||||
* Вызывается после всех маршрутизаторов и передаёт ошибку 404
|
||||
* в централизованный error middleware.
|
||||
*/
|
||||
export function notFoundHandler(req: Request, _res: Response, next: NextFunction): void {
|
||||
next(new ApiError(404, 'NOT_FOUND', `Маршрут не найден: ${req.method} ${req.originalUrl}`));
|
||||
}
|
||||
Reference in New Issue
Block a user