'use strict'; const routes = require('./routes'); const redisConnect = require('./service/redis') const socketConect = require('./service/socket') const authenticator = require('./middlewares/authenticator'); // const apiLog = require('./middlewares/api-log'); const businessRest = require('./middlewares/business-rest'); module.exports.entry = function (app, router, opts) { app.fs.logger.log('info', '[FS-AUTH]', 'Inject auth and api mv into router.'); app.fs.api = app.fs.api || {}; app.fs.api.authAttr = app.fs.api.authAttr || {}; app.fs.api.logAttr = app.fs.api.logAttr || {}; // 顺序固定 ↓ redisConnect(app, opts) socketConect(app, opts) router.use(authenticator(app, opts)); // router.use(businessRest(app, router, opts)); // router.use(apiLog(app, opts)); router = routes(app, router, opts); }; module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Sequelize, models: {} } require('./models/camera_ability')(dc); require('./models/camera_kind')(dc); require('./models/camera')(dc); require('./models/nvr')(dc); require('./models/vender')(dc); require('./models/ax_project')(dc); };