You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1021 B
31 lines
1021 B
'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')
|
|
const utils = require('./utils')
|
|
const paasRequest = require('./service/paasRequest');
|
|
|
|
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)
|
|
utils(app, opts)
|
|
paasRequest(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);
|
|
};
|
|
|