-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
30 lines (24 loc) · 731 Bytes
/
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
const express = require("express");
const connectDB = require("./services/db");
const bodyParser = require("body-parser");
const app = express();
require("dotenv").config();
const userRoute = require("./routes/user");
const locationRoute = require("./routes/location");
// db connection
connectDB();
// middlewares
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// routes
app.get("/", (req, res) => {
return res.status(200).json({
message: "app is delpoyed and tested",
});
});
app.use("/api/v1/users", userRoute);
app.use("/api/v1/location", locationRoute);
const PORT = process.env.PORT || 5000;
app.listen(PORT, () =>
console.log(`Server started on https://localhost:${PORT}`)
);