"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const view_1 = require("./view");
const proxy_1 = require("./proxy");
const controller_1 = require("./controller");
const favicon_1 = require("./favicon");
const static_1 = require("./static");
const cors_1 = require("./cors");
const exception_1 = require("./exception");
// import logger from './logger'
const helmet_1 = require("./helmet");
const request_id_1 = require("./request-id");
/**
 * 为避免中间件顺序问题，由开发者来控制
 */
function default_1(app) {
    app.use(favicon_1.default); // favicon
    app.use(static_1.default); // 静态文件
    app.use(request_id_1.default(app)); // request-id
    app.use(exception_1.default); // 异常处理
    app.use(helmet_1.default); // helmet
    // app.use(logger) // 请求日志记录
    app.use(cors_1.default); // cors
    app.use(proxy_1.default); // 代理请求需要在路由之前，否则 post 请求会 hold
    app.use(view_1.default); // 视图需要放在路由之前，路由内部调用了视图的 render
    controller_1.default(app); // 路由，非标准写法的中间件，其内部已经自行处理
}
exports.default = default_1;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvbWlkZGxld2FyZS9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLGlDQUF5QjtBQUN6QixtQ0FBMkI7QUFDM0IsNkNBQXFDO0FBQ3JDLHVDQUErQjtBQUMvQixxQ0FBNEI7QUFDNUIsaUNBQXlCO0FBQ3pCLDJDQUFtQztBQUNuQyxnQ0FBZ0M7QUFDaEMscUNBQTZCO0FBQzdCLDZDQUFvQztBQUVwQzs7R0FFRztBQUNILG1CQUF3QixHQUFRO0lBQzlCLEdBQUcsQ0FBQyxHQUFHLENBQUMsaUJBQU8sQ0FBQyxDQUFBLENBQUMsVUFBVTtJQUMzQixHQUFHLENBQUMsR0FBRyxDQUFDLGdCQUFLLENBQUMsQ0FBQSxDQUFDLE9BQU87SUFDdEIsR0FBRyxDQUFDLEdBQUcsQ0FBQyxvQkFBUyxDQUFDLEdBQUcsQ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