-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
44 lines (29 loc) · 837 Bytes
/
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
//External modules
const express = require('express');
//Middleware
const app = express();
app.set('view engine', 'ejs')
// Specifies the location of the static assets folder
app.use(express.static('static'));
app.use(express.json());
// Sets up body-parser for parsing form data
app.use(express.urlencoded({ extended: false }));
// sets up public folder for style assets
app.use("/public", express.static(__dirname + '/public'))
//instanced modules
//to create the express app
// const routes = routes();
//PORT
// const PORT = 4000;
//Routes
app.get("/", function(req,res){
res.render("home");
});
app.use("/movies", require("./routes/movies"));
app.use("/actors", require("./routes/actors"));
//404 routes
app.get((req,res)=>{
res.send("404, error!")
});
//server listener
app.listen(process.env.PORT || 5000);