-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
38 lines (29 loc) · 812 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
31
32
33
34
35
36
37
38
const express = require("express");
const bodyParser = require("body-parser");
const user = require("./routes/user");
const profile = require("./routes/profile");
const InitiateMongoServer = require("./config/db");
// Initiate Mongo Server
InitiateMongoServer();
const app = express();
// PORT
const PORT = process.env.PORT || 4000;
require('dotenv').config({ debug: process.env.DEBUG });
// Middleware
app.use(bodyParser.json());
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.get("/", (req, res) => {
res.json({ message: "API Working" });
});
/**
* Router Middleware
* Router - /user/*
* Router - /profile/*
* Method - *
*/
app.use("/user", user);
app.use("/profile", profile);
app.listen(PORT, (req, res) => {
console.log(`Server Started at PORT ${PORT}`);
});