Phase 1: Backend skeleton (Express, MongoDB, config, error middleware, health)

This commit is contained in:
Suslov-MD
2026-08-15 19:19:39 +00:00
parent 0655e918dd
commit 7d511befaa
13 changed files with 483 additions and 1 deletions
@@ -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}`));
}