|
@@ -10,6 +10,7 @@ var path = require('path'); |
|
@@ -10,6 +10,7 @@ var path = require('path'); |
10
|
var fs = require('fs');
|
10
|
var fs = require('fs');
|
11
|
var logger = console;
|
11
|
var logger = console;
|
12
|
var config = require('../config/common');
|
12
|
var config = require('../config/common');
|
|
|
13
|
+var staticOptions = require('../staticConfig');
|
13
|
|
14
|
|
14
|
/**
|
15
|
/**
|
15
|
* 模块名处理,根据环境设置模块名
|
16
|
* 模块名处理,根据环境设置模块名
|
|
@@ -135,7 +136,17 @@ exports.deepSet = function (obj,key,cb) { |
|
@@ -135,7 +136,17 @@ exports.deepSet = function (obj,key,cb) { |
135
|
});
|
136
|
});
|
136
|
}
|
137
|
}
|
137
|
|
138
|
|
|
|
139
|
+/**
|
|
|
140
|
+ * 获取API DOC配置
|
|
|
141
|
+ * @param {Object} routers 路由
|
|
|
142
|
+ */
|
138
|
exports.getInterfaceConfig = function (routers) {
|
143
|
exports.getInterfaceConfig = function (routers) {
|
|
|
144
|
+ var env = process.env.NODE_ENV || 'development';
|
|
|
145
|
+ var cssFile = 'css/all.css';
|
|
|
146
|
+ if(env !== 'development') {
|
|
|
147
|
+ cssFile = staticOptions.staticDir[env]+'/all.css';
|
|
|
148
|
+ }
|
|
|
149
|
+
|
139
|
return function(req,res) {
|
150
|
return function(req,res) {
|
140
|
if(req.query.key === config.apiKey) {
|
151
|
if(req.query.key === config.apiKey) {
|
141
|
var groupList = [];
|
152
|
var groupList = [];
|
|
@@ -160,7 +171,7 @@ exports.getInterfaceConfig = function (routers) { |
|
@@ -160,7 +171,7 @@ exports.getInterfaceConfig = function (routers) { |
160
|
|
171
|
|
161
|
navs[0].active = true;
|
172
|
navs[0].active = true;
|
162
|
groupList[0].active = true;
|
173
|
groupList[0].active = true;
|
163
|
- res.render('pages/apidoc/doc',{nav:navs,group:groupList,layout:false});
|
174
|
+ res.render('pages/apidoc/doc',{cssFile:cssFile,nav:navs,group:groupList,layout:false});
|
164
|
} else {
|
175
|
} else {
|
165
|
res.status(403).send('Permission denied');
|
176
|
res.status(403).send('Permission denied');
|
166
|
}
|
177
|
}
|