-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (25 loc) · 871 Bytes
/
app.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
const http = require('http');
const express = require('express');
var mysql = require('mysql');
var movieController = require('./controllers/movieController');
var listingController = require('./controllers/listingController');
var rankingController = require('./controllers/rankingController');
const config = require('./config.json');
var app = express();
//Set up EJS
app.set('view engine', 'ejs');
//Initialize DB Connection
var con = mysql.createConnection({
host: config.database.host,
user: config.database.username,
password: config.database.password,
database: config.database.database
});
//Set up static files
app.use('/public', express.static('public'));
movieController(app, con);
listingController(app, con);
rankingController(app, con);
//Listen to Port
app.listen(config.app.port);
console.log("Port " + config.app.port + " Initialized");