1 2 3 4 5 6 7 | D:\innovation\SwaggerProject>swagger project start Starting: D:\innovation\SwaggerProject\app.js... project started here: http://localhost:10010/ project will restart on changes. to restart at any time, enter `rs` try this: curl http://127.0.0.1:10010/hello?name=Scott |
1 2 3 4 | D:\innovation\SwaggerProject>swagger project edit Starting Swagger Editor. Opening browser to: http://127.0.0.1:49965/#/edit Do not terminate this process or close this window until finished editing. |
1 2 3 4 5 6 7 | /hello: # binds a127 app logic to a route x-swagger-router-controller: hello_world get: description: Returns 'Hello' to the caller # used as the method name of the controller operationId: hello |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | module.exports = { viewContent }; function viewContent(req, res) { console.log('viewContent : url=' + req.url); var type = req.swagger.params.type.value var htmlPath = ''; if (type === 'text'){ htmlPath = path.join(webStaticPath, 'html','text.html'); } res.sendFile(htmlPath, function (err) { if (err) { console.error(err); } else { console.log('Sent:', htmlPath); } }); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | var proxy = require('http-proxy-middleware'); /** * Configure proxy middleware */ var targetUri = http + '://' + remoteHostName:port ; var routePathList = ["/docs/docsrv","/docs/api"]; var docsProxy = proxy({ target: targetUri, changeOrigin: true, logLevel: 'debug', secure: false }) for(var i = 0; i routePathList.length; i++){ app.use(routePathList, docsProxy); } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |