-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
43 lines (22 loc) · 894 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
43
require('dotenv').config()
const express = require("express");
const app = express();
// Serve static content for the app from public directory
app.use(express.static("public"));
//const orm = require("./config/orm");
// Parse request body as Json
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// Set handlebars
var exphbs = require("express-handlebars");
app.engine("handlebars", exphbs({ defaultLayout: "main"}));
app.set("view engine", "handlebars");
var PORT = process.env.PORT || 8080;
// Import routes and give server access to them
var routes = require("./controllers/burgers_controller.js");
app.use(routes);
// Start our server so that it can begin listening to client requests.
app.listen(PORT, function () {
// Log (server-side) when our server has started
console.log("Server listening on: http://localhost:" + PORT);
});