Skip to content

Commit

Permalink
Merge pull request #11 from caions/fix/swagger-css
Browse files Browse the repository at this point in the history
chore: add swagger cdn css
  • Loading branch information
caions authored Oct 4, 2023
2 parents f7e135e + 13ec235 commit 2998fcf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "habit-tracker-backend",
"version": "1.1.3",
"version": "1.1.4",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
8 changes: 7 additions & 1 deletion src/infra/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ import { executeMigrations } from './db/runMigrations';
import { logger } from '../adapters/logger';
const app = express();
const PORT = process.env.PORT || 8000;
const CSS_URL =
'https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.1.0/swagger-ui.min.css';

app.use(cors());
app.use(express.json());
app.use(loggerMiddleware);
app.use(routes);
app.use(errorHandler);
app.use('/doc', swaggerUi.serve, swaggerUi.setup(swaggerFile));
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
2 changes: 1 addition & 1 deletion vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"headers": [
{
"source": "/(.*)",
"source": "/api/(.*)",
"headers": [
{ "key": "Access-Control-Allow-Credentials", "value": "true" },
{ "key": "Access-Control-Allow-Origin", "value": "*" },
Expand Down

0 comments on commit 2998fcf

Please sign in to comment.