-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
32 lines (25 loc) · 931 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
// Importing all dependencies
var express = require("express");
var bodyParser = require("body-parser");
var expressHandleBars = require("express-handlebars");
//import routew
var routes = require("./controllers/burger-controller.js");
// console.log(routes);
// Declaring port
var port = process.env.PORT || 3000;
// Initializing express app
var app = express();
// Serve static content for the app from the "public" directory in the application directory.
app.use(express.static("public"));
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// Setting handlebars as templating engine
app.engine("handlebars", expressHandleBars({ defaultLayout: "main" }));
app.set("view engine", "handlebars");
// app.enable('view cache');
// Setting the root path
app.use("/", routes);
// Listening on declared port
app.listen(port, function(){
console.log("listening on port", port);
});