-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
52 lines (39 loc) · 1.26 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
const express = require("express");
const exphbs = require("express-handlebars");
const bodyParser = require("body-parser");
const mysql = require("mysql");
require("dotenv").config();
const app = express();
const port = process.env.PORT || 8080;
//Parsing middleware
//Parse application/ x-ww-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// Parse appllication/json
app.use(bodyParser.json());
//static files
app.use(express.static("public"));
//templation engine
app.engine("hbs", exphbs.engine({ extname: ".hbs" }));
app.set("view engine", "hbs");
// <<<<<<< Updated upstream
// //Router to render the page
// app.get("", (req, res) => {
// res.render("home.hbs");
// // res.render("movies.hbs");
// // res.render("series.hbs");
// });
// =======
// const pool = mysql.createPool({
// connectionLimit : 100, //important
// host : 'localhost',
// database : 'Video_Streaming',
// user : 'root',
// password : 'Bestteemo',
// });
// pool.getConnection((err, connection) => {
// if(err) throw err;
// console.log('Connected as ID ' + connection.threadId);
// });
const routes = require('./server/routes/Movies');
app.use('/', routes);
app.listen(port, () => console.log("Listening on port " + port));