-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: minimal swagger ui integration
- Loading branch information
Showing
8 changed files
with
728 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
export { router as groupRoutes } from '@/modules/groups/groups.routes' | ||
export { router as memberRoutes } from '@/modules/members/members.routes' | ||
export { router as userRoutes } from '@/modules/users/users.routes' | ||
import { Router } from 'express' | ||
import { auth } from './middlewares' | ||
|
||
import { router as groupRoutes } from '@/modules/groups/groups.routes' | ||
import { router as memberRoutes } from '@/modules/members/members.routes' | ||
import { router as userRoutes } from '@/modules/users/users.routes' | ||
|
||
const rootRouter = Router() | ||
|
||
rootRouter.use('/api/users', userRoutes) | ||
rootRouter.use('/api/groups', auth, groupRoutes) | ||
rootRouter.use('/api/members', auth, memberRoutes) | ||
|
||
export default rootRouter |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import swaggerAutogen from 'swagger-autogen' | ||
|
||
const doc = { | ||
info: { | ||
version: '1.0.0', | ||
title: 'mChat', | ||
description: 'Realtime messenger powered by socket.io', | ||
}, | ||
host: 'localhost:3000', | ||
components: { | ||
securitySchemes: { | ||
bearerAuth: { | ||
type: 'http', | ||
scheme: 'bearer', | ||
}, | ||
}, | ||
}, | ||
schemes: ['http', 'https'], | ||
} | ||
|
||
const outputFile = '../swagger-output.json' | ||
const routes = ['./../routes.ts'] | ||
|
||
/* NOTE: If you are using the express Router, you must pass in the 'routes' only the | ||
root file where the route starts, such as index.js, app.js, routes.js, etc ... */ | ||
|
||
swaggerAutogen()(outputFile, routes, doc) |
Oops, something went wrong.