Open dancju opened 6 years ago
what I did:
const routerV0 = new Router({ apiDoc: path.join(__dirname, 'api-v0'), apiExplorerVisible: true, }) routerV0.mount(middleware, path.join(__dirname, 'controllers-v0')) app.use(routerV0.routes()) const routerDash = new Router({ apiDoc: path.join(__dirname, 'api-dash'), apiExplorerVisible: true, }) routerDash.mount(middleware, path.join(__dirname, 'controllers-dash')) app.use(routerDash.routes())
what I got:
$ curl http://localhost:8081/api-explorer {"result":"<!-- HTML for static distribution bundle build -->\n<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <title>Swagger UI</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"./swagger-ui.css\" >\n <link rel=\"icon\" type=\"image/png\" href=\"./favicon-32x32.png\" sizes=\"32x32\" />\n <link rel=\"icon\" type=\"image/png\" href=\"./favicon-16x16.png\" sizes=\"16x16\" />\n <style>\n html\n {\n box-sizing: border-box;\n overflow: -moz-scrollbars-vertical;\n overflow-y: scroll;\n }\n\n *,\n *:before,\n *:after\n {\n box-sizing: inherit;\n }\n\n body\n {\n margin:0;\n background: #fafafa;\n }\n </style>\n </head>\n\n <body>\n <div id=\"swagger-ui\"></div>\n\n <script src=\"./swagger-ui-bundle.js\"> </script>\n <script src=\"./swagger-ui-standalone-preset.js\"> </script>\n <script>\n window.onload = function() {\n\n // Build a system\n const ui = SwaggerUIBundle({\n configUrl: \"./api-explorer-config.json\",\n dom_id: '#swagger-ui',\n deepLinking: true,\n presets: [\n SwaggerUIBundle.presets.apis,\n SwaggerUIStandalonePreset\n ],\n plugins: [\n SwaggerUIBundle.plugins.DownloadUrl\n ],\n layout: \"StandaloneLayout\"\n })\n\n window.ui = ui\n }\n </script>\n </body>\n</html>\n","statusCode":200}⏎
Was it I made some mistake or two-router is not supported yet?
Two-router is not supported yet. api-explorer will not work fine.
@nerdDan check out https://github.com/kogosoftwarellc/open-api/tree/master/packages/koa-openapi. 2 routers can be used no problem.
what I did:
what I got:
Was it I made some mistake or two-router is not supported yet?