Skip to content

Commit cdb35b4

Browse files
committed
Merge branch 'master' into minsung
2 parents fe5668e + 7d781eb commit cdb35b4

92 files changed

Lines changed: 17984 additions & 519 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

chatting/src/app.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ const logger = require('morgan');
66
const dotenv = require('dotenv');
77
const cors = require('cors');
88

9+
const swaggerJSDoc = require('swagger-jsdoc');
10+
const swaggerUi = require('swagger-ui-express');
11+
const swaggerDefinition = require('./config/swaggerDefinition');
12+
913
const mongooseDB = require('./models');
1014

1115
const indexRouter = require('./routes/index');
@@ -16,6 +20,13 @@ const chatRouter = require('./routes/chat');
1620
const app = express();
1721
dotenv.config();
1822

23+
const options = {
24+
swaggerDefinition,
25+
apis: ['./routes/chat.js']
26+
};
27+
28+
const swaggerSpec = swaggerJSDoc(options);
29+
1930
// view engine setup
2031
app.set('views', path.join(__dirname, 'views'));
2132
app.set('view engine', 'ejs');
@@ -27,6 +38,7 @@ app.use(cookieParser());
2738
app.use(express.static(path.join(__dirname, 'public')));
2839
app.use(cors());
2940

41+
app.use('/api-docs',swaggerUi.serve,swaggerUi.setup(swaggerSpec));
3042
app.use('/', indexRouter);
3143
app.use('/users', usersRouter);
3244
app.use('/tests',testRouter);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
openapi: '3.0.0',
3+
info: {
4+
title: "Chatting Server",
5+
version: "0.0.1",
6+
description: "Chat Server API"
7+
},
8+
9+
};

0 commit comments

Comments
 (0)