-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·43 lines (29 loc) · 844 Bytes
/
index.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
(function () {
"use strict"
var express = require('express');
var app = express();
var path = require("path");
app.set("port", (process.env.PORT || 8080));
app.use(express.static(path.join(__dirname, 'build')));
app.engine('html', require('ejs').renderFile);
app.set('view engine', 'html');
app.set("views", path.join(__dirname,"/build"));
app.get("/", function (req, res) {
res.render("index");
});
app.get("/index", function (req, res) {
res.redirect("/");
});
app.get("/catalog", function (req, res) {
res.render("catalog");
});
app.get("/form", function (req, res) {
res.render("form");
});
app.use(function (req, res) {
res.sendStatus(404);
});
app.listen(app.get("port"), function () {
console.log("Node app is running on port ", app.get("port"));
});
})();