-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
35 lines (29 loc) · 825 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
"use strict";
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const app = express();
const appAPI = require("./routes/app-api");
const mailAPI = require("./routes/mail-api.js");
// Express body parser
app.use(cors());
app.use(bodyParser.json());
app.use(
bodyParser.urlencoded({
limit: "50mb",
extended: false,
parameterLimit: 50000,
})
);
// set the ejs as view engine
app.set("view engine", "ejs");
// setup public folder
app.use(express.static("./public"));
// use the routes specified in route folder
app.use("/", appAPI);
app.use("/api/v1", mailAPI);
const port = process.env.PORT || 4444;
//listen to the server
app.listen(port, function () {
console.log(`listening to the port ${port} .....`);
});