"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createApp = void 0;
const express_1 = __importDefault(require("express"));
const security_middleware_1 = require("../../interface/middleware/security.middleware");
const error_handler_middleware_1 = require("../../interface/middleware/error-handler.middleware");
const createApp = (logger, redis, routes, middlewares) => {
    const app = (0, express_1.default)();
    (0, security_middleware_1.applySecurityMiddleware)(app, redis);
    app.use(express_1.default.json());
    app.use(express_1.default.urlencoded({ extended: true }));
    app.use(middlewares.requestId);
    app.use(middlewares.sanitization);
    app.use(middlewares.auditLogger);
    app.use('/images', routes.imageRouter);
    app.use('/api/v1', routes.apiRouter);
    app.get('/health', (_req, res) => {
        res.status(200).json({ status: 'ok' });
    });
    app.use((0, error_handler_middleware_1.errorHandlerMiddleware)(logger));
    return app;
};
exports.createApp = createApp;
//# sourceMappingURL=app.factory.js.map