-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
39 lines (31 loc) · 930 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
39
// DOT ENV CONFIGURATION
const dotenv = require("dotenv");
var dotenvExpand = require("dotenv-expand");
var myEnv = dotenv.config();
dotenvExpand(myEnv);
// REQUIRING NECESSARY APPS : EXPRESS - BODYPARSER - CORS
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const InitiateMongoServer = require("./src/utils/db");
// INIT
InitiateMongoServer();
const app = express();
// PORT
const port = process.env.PORT || 8083;
// ROUTES
const subscription = require("./src/routes/Subscription");
const user = require("./src/routes/User");
//MIDDLEWARES
app.use(bodyParser.json());
app.use(cors());
app.use("/subscription", subscription);
app.use("/user", user);
app.get("/", (req, res) => {
res.send(
"welcome to the push service provided by your friendly neighberhood belkacember"
);
});
app.listen(port, () => {
console.log(`listening on port : ${port}`);
});