Skip to content

Commit

Permalink
Merge pull request #54 from kaleido-io/routes
Browse files Browse the repository at this point in the history
Add UI routes last
  • Loading branch information
dechdev committed Apr 19, 2022
2 parents afdabfd + cc0989d commit 724e611
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ wsConfig.websockets.forEach((w) => new w().init(wsConfig.prefix, wsConfig.handle

const api = genOpenAPI(serverOptions);

app.use('/api', swaggerUi.serve);
app.get('/api', swaggerUi.setup(api));
app.get('/api-json', (req, res) => {
res.type('text').send(JSON.stringify(api, null, 2));
});

const UI_PATH = process.env.UI_PATH;
if (UI_PATH) {
console.log(`UI Served from ${UI_PATH}`);
Expand All @@ -52,12 +58,6 @@ if (UI_PATH) {
});
}

app.use('/api', swaggerUi.serve);
app.get('/api', swaggerUi.setup(api));
app.get('/api-json', (req, res) => {
res.type('text').send(JSON.stringify(api, null, 2));
});

const server = new http.Server(app);
server.on('upgrade', function upgrade(request, socket, head) {
if (!wsConfig.handler.handleUpgrade(request, socket, head)) {
Expand Down

0 comments on commit 724e611

Please sign in to comment.