Skip to content

Commit

Permalink
Merge pull request #3 from clout-js-modules/bugfix/ISSUE-1+2
Browse files Browse the repository at this point in the history
[ISSUE-1] [ISSUE-2] Fixed issues
  • Loading branch information
muhammaddadu authored Jul 4, 2018
2 parents 4a91f47 + 8ab421e commit 1072110
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 4 additions & 2 deletions hooks/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = {
}

endpointMeta.methods.forEach((method) => {
openapi.paths[endpointMeta.path][method] = {
openapi.paths[`/api${endpointMeta.path}`][method] = {
description: endpointMeta.description,
tags: [endpointMeta.group]
};
Expand All @@ -61,7 +61,9 @@ module.exports = {
});

this.app.get(conf.basePath, (req, resp) => {
resp.render('apidocs.ejs');
resp.render('apidocs.ejs', {
config: conf
});
});
this.app.use(conf.basePath, express.static(swaggerUiAssetPath));

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clout-swagger",
"version": "1.0.0",
"version": "1.0.1",
"description": "Clout module to leverage swagger for apis",
"main": "index.js",
"scripts": {
Expand Down
14 changes: 7 additions & 7 deletions views/apidocs.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<meta charset="UTF-8">
<title>Clout-JS Docs (Swagger)</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<link rel="stylesheet" type="text/css" href="<%=config.basePath%>/swagger-ui.css" >
<link rel="icon" type="image/png" href="<%=config.basePath%>/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="<%=config.basePath%>/favicon-16x16.png" sizes="16x16" />
<style>
html {
box-sizing: border-box;
Expand Down Expand Up @@ -66,15 +66,15 @@

<div id="swagger-ui"></div>

<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script src="<%=config.basePath%>/swagger-ui-bundle.js"> </script>
<script src="<%=config.basePath%>/swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function () {
const INFO_SELECTOR = 'info';
const logoImage = document.createElement('img');
const ui = SwaggerUIBundle({
url: "/docs/openapi.json",
url: "<%=config.basePath%>/openapi.json",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
Expand All @@ -100,4 +100,4 @@ window.onload = function () {
</script>
</body>

</html>
</html>

0 comments on commit 1072110

Please sign in to comment.