-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
55 lines (47 loc) · 1.07 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require('dotenv').config();
const express = require('express');
const expressLayout = require("express-ejs-layouts");
const app = express();
const port = process.env.PORT || 3000;
// Layout
app.use(expressLayout);
app.use(express.json());
app.set('view engine', 'ejs');
app.set("layout", "./layouts/main");
app.use(express.urlencoded({ extended: true }));
// Access Static folder
app.use(express.static("public"));
// Route Home
app.get('/', (req, res) => {
res.render('index', {
title: "HomePage"
});
});
// Route Login
app.get('/login', (req, res) => {
res.render('login', {
title: "Login"
});
});
// Route Movies
app.get('/movies', (req, res) => {
res.render('movies', {
title: "Movie"
});
});
// Route Register
app.get('/register', (req, res) => {
res.render('register', {
title: "Register"
});
});
// Route Series
app.get('/series', (req, res) => {
res.render('series', {
title: "Series"
});
});
// Starting app
app.listen(port, () => {
console.log(`Server running at http://localhost:${port}/`);
})