'use strict'; const routes = require('./routes'); const authenticator = require('./middlewares/authenticator'); // const apiLog = require('./middlewares/api-log'); const redisConnect = require('./service/redis') const schedule = require('./schedule') 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) schedule(app, opts) router.use(authenticator(app, opts)); // router.use(apiLog(app, opts)); router = routes(app, router, opts); }; module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Sequelize, models: {} } require('./models/user')(dc); require('./models/user_token')(dc); };