2015-05-05 11:56:35 +02:00
|
|
|
var http = require('http');
|
|
|
|
var express = require('express');
|
|
|
|
var module = require('./my_modules/filterInt');
|
2015-05-05 16:30:51 +02:00
|
|
|
var jade = require('jade');
|
2015-05-05 11:56:35 +02:00
|
|
|
|
|
|
|
var app = express();
|
|
|
|
|
|
|
|
var urls = require('./urls');
|
|
|
|
|
2015-05-05 16:30:51 +02:00
|
|
|
app.set('view engine', 'jade');
|
2015-05-05 11:56:35 +02:00
|
|
|
|
|
|
|
app.use(function(req, res, next) {
|
|
|
|
res.locals.title = "3DUI";
|
|
|
|
res.locals.urls = urls;
|
|
|
|
next();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Load controllers
|
|
|
|
require('./lib/boot')(app, { verbose: !module.parent });
|
|
|
|
|
|
|
|
app.use('/static', express.static('static'));
|
|
|
|
|
|
|
|
app.use(function(err, req, res, next) {
|
|
|
|
if (err.status === 404) {
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
|
|
|
|
2015-05-05 16:30:51 +02:00
|
|
|
res.render('404.jade', res.locals, function(err, result) {
|
2015-05-05 11:56:35 +02:00
|
|
|
res.send(result);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
app.use(function(req, res) {
|
|
|
|
res.setHeader('Content-Type', 'text/html');
|
|
|
|
|
2015-05-05 16:30:51 +02:00
|
|
|
res.render('404.jade', res.locals, function(err, result) {
|
2015-05-05 11:56:35 +02:00
|
|
|
res.send(result);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
app.listen(4000);
|