-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
32 lines (22 loc) · 818 Bytes
/
app.js
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
const express = require('express')
const app = express()
const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./swagger.json');
const mongoose = require('mongoose')
const authRoute = require('./routes/auth')
const scribbleRoute = require('./routes/scribble')
const bodyParser = require('body-parser')
require('dotenv/config')
app.use(bodyParser.json())
app.use('/user', authRoute)
app.use('/scribble', scribbleRoute)
app.get('/', (req,res) => {
res.send('Welcome to Scribble App, where you can scribble your thoughts and read from others.')
})
app.use('/api-docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument));
mongoose.connect(process.env.DB_CONNECTOR, ()=>{
console.log('DB is connected')
})
app.listen(3000, () => {
console.log('Listening to port 3000.')
})