-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.js
37 lines (29 loc) · 951 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
const express = require("express");
var cors = require("cors");
const path = require("path");
const app = express();
const port = process.env.PORT || 80;
app.use(cors());
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
// EJS engine
app.set("view engine", "ejs");
app.set("views", "public");
//Serve static files
app.use(express.static(path.join(__dirname, "public")));
// Event Route
const eventRoute = require("./routes/event-route.js");
app.use("/event", eventRoute);
// Main Route
const mainRoute = require("./routes/main-route.js");
app.use("/", mainRoute);
// Database Connection
// const connection = require("./utils/database");
// connection.on("error", console.error.bind(console, "connection error: "));
// connection.once("open", function () {
// console.log("Database Connected successfully");
// })
// Starting App
app.listen(port, function(){
console.log("App is running at port " + port);
})