common-rod 1.8.1 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +0 -1
- package/lib/openAPI.js +5 -3
- package/lib/rodSession.js +26 -1
- package/package.json +1 -1
- package/readme.md +9 -0
package/index.js
CHANGED
|
@@ -648,7 +648,6 @@ function _startServer(app, envServer, appRodSession){
|
|
|
648
648
|
Object.assign( options, envServer.https_options);
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
|
|
652
651
|
let server = https.createServer(options, app)
|
|
653
652
|
server.listen(envServer.app_port, envServer.app_host, () => {
|
|
654
653
|
appRodSession.info(`Is Secure : | Port : ${envServer.app_port}`);
|
package/lib/openAPI.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const swaggerUi = require('swagger-ui-express');
|
|
2
|
+
const express = require('express');
|
|
2
3
|
const fs = require('fs');
|
|
3
4
|
const path = require('path');
|
|
4
|
-
const { log } = require('console');
|
|
5
5
|
const currentAppPath = path.dirname(require.main.filename);
|
|
6
6
|
// const pjson = require(currentAppPath + '/package.json');
|
|
7
7
|
let pjson = {};
|
|
@@ -170,6 +170,7 @@ let openAPI = function () {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
+
app.use('/api-docs/img/', express.static(path.join(__dirname, '../res')));
|
|
173
174
|
|
|
174
175
|
// console.log(JSON.stringify(spec, null, 4));
|
|
175
176
|
app.use('/api-docs/', function(req, res, next){
|
|
@@ -177,9 +178,10 @@ let openAPI = function () {
|
|
|
177
178
|
if(req.originalUrl === '/api-docs/'){
|
|
178
179
|
spec.servers = [{"url" : req.protocol + "://"+req.get('host')}];
|
|
179
180
|
req.swaggerDoc = spec;
|
|
180
|
-
}else if(req.url.startsWith("/img/")){
|
|
181
|
-
return res.sendFile( path.resolve( __dirname + "/../res/" + req.url.substring("/img/".length)) );
|
|
182
181
|
}
|
|
182
|
+
// else if(req.url.startsWith("/img/")){
|
|
183
|
+
// return res.sendFile( path.resolve( __dirname + "/../res/" + req.url.substring("/img/".length)) );
|
|
184
|
+
// }
|
|
183
185
|
next();
|
|
184
186
|
}, swaggerUi.serve, swaggerUi.setup(null, options));
|
|
185
187
|
|
package/lib/rodSession.js
CHANGED
|
@@ -186,7 +186,32 @@ RodSession.prototype = function () {
|
|
|
186
186
|
return this._selectorAppConf(key,false);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
},
|
|
189
|
+
},
|
|
190
|
+
https : ()=>{
|
|
191
|
+
return {
|
|
192
|
+
request_old : (optionAttribute)=>{
|
|
193
|
+
return httpService.request(this, optionAttribute);
|
|
194
|
+
},
|
|
195
|
+
request : (optionAttribute)=>{
|
|
196
|
+
return httpService2.requestHttp(this, optionAttribute)
|
|
197
|
+
.catch((err)=>{
|
|
198
|
+
this.warn("this.utils().https().request", err.message);
|
|
199
|
+
return err;
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
isError : (res)=>{
|
|
203
|
+
if(Array.isArray(res)){
|
|
204
|
+
for (let i = 0; i < res.length; i++) {
|
|
205
|
+
if( typeof res[i] === 'string') return true;
|
|
206
|
+
}
|
|
207
|
+
return false;
|
|
208
|
+
}else {
|
|
209
|
+
return typeof res === 'string'
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
},
|
|
190
215
|
http : ()=>{
|
|
191
216
|
return {
|
|
192
217
|
request_old : (optionAttribute)=>{
|
package/package.json
CHANGED
package/readme.md
CHANGED