Created
June 22, 2020 18:02
-
-
Save avivshafir/2348f1ed8513dd1fd58cf583668ffa9a to your computer and use it in GitHub Desktop.
API v4 Docs Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const path = require('path'); | |
const swaggerCombine = require('swagger-combine'); | |
const config = { | |
swagger: '2.0', | |
info: { | |
title: 'v4 API', | |
version: { | |
$ref: './package.json#/version', | |
}, | |
}, | |
apis: [ | |
{ | |
url: 'http://localhost:8080/swagger.json', | |
}, | |
{ | |
url: 'http://localhost:3000/swagger.json', | |
} | |
] | |
}; | |
const app = express(); | |
app.use(express.static(path.join(__dirname, 'public'))); | |
app.get('/docs', (req, res) => { | |
swaggerCombine(config) | |
.then(json => { | |
res.json(json); | |
}) | |
.catch(console.error); | |
}); | |
app.listen(8888, () => console.log('ClimaCell Docs Service listening on port 8888!')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment