-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
37 lines (32 loc) · 1.25 KB
/
index.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
const express = require("express");
const app = express();
const userRouter = require("./routes/user_router");
const helmet = require("helmet");
const cors = require("cors");
const bodyParser = require("body-parser");
const db = require("./config/dbconfig");
const rideRouter = require("./routes/ride_router");
const cityRouter = require("./routes/city_router");
/********************************************
* ************Configuring Dependencies***********
* ******************************************/
/*****************************************************
* ***************Dependencies Express*********
* *************************************************/
require("dotenv").config();
app.use(helmet()); // User to stop adding headers which can cayse potential security issue
app.use(bodyParser.json());
app.use(cors());
/*****************************************************
* ***************Defining all Routes(mini apps)*********
* *************************************************/
app.use("/user", userRouter);
app.use("/ride", rideRouter);
app.use("/city", cityRouter);
app.get("**", (req, res) => {
res.send("sorry nothing for you");
});
var port = process.env.PORT || 5000;
app.listen(port, () => {
console.log("Backend is listening at port", port);
});