-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
35 lines (26 loc) · 799 Bytes
/
server.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
const express = require("express");
const cors = require("cors");
// Load .env file configs
require("dotenv").config();
// Connect to MongoDB
require("./db");
// Connect to MongoDB to update
// require("./db_update");
const PORT = process.env.PORT;
// Init Express app
const app = express();
// Set up Middlewares
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cors({ origin: "*" }));
// Middleware for Router module
app.use(require('./router/register'));
app.use(require('./router/login'));
app.use(require('./router/sendticket'));
app.use(require('./router/signout'));
app.use(require('./router/getdata'));
app.use(require('./router/attendance'));
// Start the server
app.listen(PORT, () => {
console.log(`[+] Server is running on port ${PORT}`);
});