-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
25 lines (19 loc) · 878 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
const express = require("express"); //Import the express dependency
const bodyParser = require("body-parser");
const cors = require("cors");
require("dotenv").config();
const app = express(); //Instantiate an express app, the main work horse of this server
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
// Init DB connection
require("./config/database.config");
// imports the API from the apis folder
const userController = require("./controllers/user.controller");
const userLeavesController = require("./controllers/user-leave.controller")
app.use("/api/users", userController);
app.use("/api/users-leaves", userLeavesController);
app.listen(process.env.PORT, () => {
//server starts listening for any attempts from a client to connect at port: {port}
console.log(`Now listening on port ${process.env.PORT}`);
});