-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
32 lines (25 loc) · 1013 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
var ejs = require("ejs"),
partials = require("express-partials"),
express = require("express"),
app = express();
var routes = require("./routes/index.js");
app.configure(function () {
app.use(partials());
app.engine("html", require("ejs").renderFile); //renders .ejs as html
app.set("views", __dirname + "/views");
app.use(express.static(__dirname + "/public"));
app.use(express.bodyParser()); //deals with incoming request objects
app.use(express.methodOverride());
/**** Turn on some debugging tools ****/
app.use(express.logger()); // sends messages into the terminal
app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); //dumpExceptions - directs exceptions to stderr - showStack - generate HTML for an exception å
});
app.get("/", routes.main);
app.post("/check", routes.check);
app.get("*", function (req, res) {
res.render("404.html");
});
var port = process.env.PORT || 5000;
app.listen(port, function () {
console.log("Listening on " + port);
});