Skip to content

Instantly share code, notes, and snippets.

@avivshafir
Created June 22, 2020 18:02
Show Gist options
  • Save avivshafir/2348f1ed8513dd1fd58cf583668ffa9a to your computer and use it in GitHub Desktop.
Save avivshafir/2348f1ed8513dd1fd58cf583668ffa9a to your computer and use it in GitHub Desktop.
API v4 Docs Service
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