Skip to content

Commit

Permalink
chore: add swagger css cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
caions committed Oct 4, 2023
1 parent 9e49323 commit 36bee4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion habits-document.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"swagger": "2.0",
"info": {
"version": "1.1.0",
"version": "1.1.1",
"title": "Habit Tracker API",
"description": "Api to manage habits"
},
Expand Down
9 changes: 8 additions & 1 deletion src/infra/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ app.use(express.json());
app.use(loggerMiddleware);
app.use(routes);
app.use(errorHandler);
app.use('/doc', swaggerUi.serve, swaggerUi.setup(swaggerFile));
const CSS_URL =
'https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.1.0/swagger-ui.min.css';

app.use(
'/doc',
swaggerUi.serve,
swaggerUi.setup(swaggerFile, { customCssUrl: CSS_URL }),
);
app.get('/', (_, res: Response) => res.json('api version: ' + version));
app.listen(PORT, () => {
executeMigrations(), logger.info(`server running on localhost:${PORT}`);
Expand Down

0 comments on commit 36bee4c

Please sign in to comment.