...
|
...
|
@@ -10,6 +10,7 @@ var path = require('path'); |
|
|
var fs = require('fs');
|
|
|
var logger = console;
|
|
|
var config = require('../config/common');
|
|
|
var staticOptions = require('../staticConfig');
|
|
|
|
|
|
/**
|
|
|
* 模块名处理,根据环境设置模块名
|
...
|
...
|
@@ -135,7 +136,17 @@ exports.deepSet = function (obj,key,cb) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取API DOC配置
|
|
|
* @param {Object} routers 路由
|
|
|
*/
|
|
|
exports.getInterfaceConfig = function (routers) {
|
|
|
var env = process.env.NODE_ENV || 'development';
|
|
|
var cssFile = 'css/all.css';
|
|
|
if(env !== 'development') {
|
|
|
cssFile = staticOptions.staticDir[env]+'/all.css';
|
|
|
}
|
|
|
|
|
|
return function(req,res) {
|
|
|
if(req.query.key === config.apiKey) {
|
|
|
var groupList = [];
|
...
|
...
|
@@ -160,7 +171,7 @@ exports.getInterfaceConfig = function (routers) { |
|
|
|
|
|
navs[0].active = true;
|
|
|
groupList[0].active = true;
|
|
|
res.render('pages/apidoc/doc',{nav:navs,group:groupList,layout:false});
|
|
|
res.render('pages/apidoc/doc',{cssFile:cssFile,nav:navs,group:groupList,layout:false});
|
|
|
} else {
|
|
|
res.status(403).send('Permission denied');
|
|
|
}
|
...
|
...
|
|