-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
34 lines (27 loc) · 791 Bytes
/
app.js
File metadata and controls
34 lines (27 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const express=require('express')
const app=express()
const noteRouter=require('./routes/notes')
const swaggerJsDocs=require('swagger-jsdoc')
const swaggerUI=require('swagger-ui-express')
//const router = require('./routes/animals')
require('./db/mongoose')
app.use(express.json())
app.use(noteRouter)
const swaggerOptions={
definition: {
openapi:'3.0.0',
info:{
title:'Notes App',
version:'1.0.0',
// servers:["http://localhost:3000"]
}
},
apis:["./routes/notes.js"]
}
const swaggerDocs=swaggerJsDocs(swaggerOptions)
console.log(swaggerDocs)
app.use('/api-docs',swaggerUI.serve,swaggerUI.setup(swaggerDocs))
const port=process.env.PORT || 3000
app.listen(port,()=>{
console.log(`Server is on port ${port}`)
})