-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
43 lines (33 loc) · 937 Bytes
/
server.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
33
34
35
36
37
38
39
40
41
42
43
require("dotenv").config();
const express = require('express');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const Port = process.env.PORT || 1000;
mongoose.Promise = global.Promise;
mongoose.connect(process.env.MONGO_URI, {
useUnifiedTopology: true,
useFindAndModify: false,
useCreateIndex: true,
useNewUrlParser: true,
})
.then(() => {
console.log("Connection Success");
})
.catch((error) => {
console.log("Connection Failed");
process.exit();
});
const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.get('/', (req, res) => {
res.json({
message: "Welcome"
})
});
require("./src/routes/UserRoute")(app);
require("./src/routes/AuthRoute")(app);
require("./src/routes/AppointmentRoute")(app);
app.listen(Port, () => {
console.log("Listen Success to " + Port);
})