-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
35 lines (22 loc) · 834 Bytes
/
server.js
File metadata and controls
35 lines (22 loc) · 834 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
28
29
30
31
32
33
34
35
var express = require("express");
var exphbs = require("express-handlebars");
const path = require('path')
var app = express();
var PORT = process.env.PORT || 8080;
// Sets up the Express app to handle data parsing
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// Use public CSS
app.use(express.static(path.join(__dirname, '/public')));
// To use handlebars
app.engine("handlebars", exphbs({ defaultLayout: "main" }));
app.set("view engine", "handlebars");
// Import Routes
var router = require("./controllers/soups_controller");
// Use express routes
app.use(router);
// 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);
});