-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
36 lines (32 loc) · 971 Bytes
/
app.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
const express = require("express");
const app = express();
const expressLayouts = require("express-ejs-layouts");
const port = process.env.PORT || "3000";
var sassMiddleware = require("node-sass-middleware");
// Setup SASS directories
var path = require("path");
var srcPath = __dirname + "/sass";
var destPath = __dirname + "/public/stylesheets";
app.use(
sassMiddleware({
src: path.join(__dirname, "sass"),
dest: path.join(__dirname, "public/css"),
debug: true,
outputStyle: "compressed",
prefix: "/css",
}),
// set default folder for importing css,jsand images
express.static(path.join(__dirname, "public"))
);
app.use(expressLayouts);
app.set("view engine", "ejs");
//routes
app.get("/", function (req, res) {
res.render("home", { title: "Home" });
});
app.get("/contact", function (req, res) {
res.render("contact", { title: "Contact" });
});
app.listen(port, function () {
console.log("server is listening at port", port);
});