forked from apis-is/docs-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.js
58 lines (46 loc) · 1.19 KB
/
bootstrap.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// -- Module dependencies
var express = require('express');
// -- Global paths
var views = __dirname + '/app/views',
static_root = __dirname + '/public';
/**
* Express base configuration
* Bootstrap
*/
module.exports.boot = function(app) {
/**
* Global configuration
*/
app.configure(function() {
// -- Define view engine with its options
app.set('views', views);
app.set('view engine', 'jade');
// -- Set uncompressed html output and disable layout templating
app.locals({
pretty : true,
layout: false
});
// -- Parses x-www-form-urlencoded request bodies (and json)
app.use(express.bodyParser());
app.use(express.methodOverride());
// -- Express routing
app.use(app.router);
// -- Static ressources
app.use(express.favicon());
app.use(express.static(static_root));
// -- 500 status
app.use(function(err, req, res, next) {
res.render('500', {
status: err.status || 500,
error: err
});
});
// -- 404 status
app.use(function(req, res, next) {
res.render('404', {
status: 404,
url: req.url
});
});
});
}