-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
27 lines (20 loc) · 714 Bytes
/
server.js
File metadata and controls
27 lines (20 loc) · 714 Bytes
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
// Import express
const express = require("express");
// Get my port number
const PORT = process.env.PORT || 8080;
// Initialize the app
const app = express();
// Serve static content
app.use(express.static("public"));
// Parse requests/responses as JSON
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// Import handlebars and set it up as the view engine
app.engine("handlebars", require("express-handlebars")({ defaultLayout: "main" }));
app.set("view engine", "handlebars");
// Import routes and tell the app to use them
app.use(require("./controllers/burgers_controller"));
// Start the server
app.listen(PORT, () => {
console.log(`Server listening on port ${PORT}`);
});