Skip to content

Commit

Permalink
More refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
myrotvorets-team committed Mar 20, 2024
1 parent 5795fd1 commit 6f5f931
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import { installOpenApiValidator } from '@myrotvorets/oav-installer';
import { errorMiddleware, notFoundMiddleware } from '@myrotvorets/express-microservice-middlewares';
import { createServer, getTracer, recordErrorToSpan } from '@myrotvorets/otel-utils';
import {
LoggerFromRequestFunction,
type LoggerFromRequestFunction,
errorLoggerHook,
requestDurationMiddleware,
requestLoggerMiddleware,
} from '@myrotvorets/express-otel-middlewares';

import { LocalsWithContainer, initializeContainer, scopedContainerMiddleware } from './lib/container.mjs';
import { type LocalsWithContainer, initializeContainer, scopedContainerMiddleware } from './lib/container.mjs';

import { searchController } from './controllers/search.mjs';
import { monitoringController } from './controllers/monitoring.mjs';
Expand Down Expand Up @@ -38,7 +39,9 @@ export function configureApp(app: Express): ReturnType<typeof initializeContaine
installOpenApiValidator(join(base, 'specs', 'dzhura-private.yaml'), env.NODE_ENV),
searchController(),
notFoundMiddleware,
errorMiddleware(),
errorMiddleware({
beforeSendHook: errorLoggerHook(loggerFromRequest),
}),
);
return container;
} /* c8 ignore start */ catch (e) {
Expand Down

0 comments on commit 6f5f931

Please sign in to comment.