Added some more deps and fixed some tabs.

This commit is contained in:
Bram van der Veen 2015-06-24 11:08:37 +02:00
parent 688c5dd513
commit c86044882f
2 changed files with 14 additions and 11 deletions

View file

@ -9,11 +9,12 @@
"author": "Bram van der Veen", "author": "Bram van der Veen",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"body-parser": "^1.13.1",
"cheerio": "^0.19.0", "cheerio": "^0.19.0",
"express": "^4.12.4", "express": "^4.12.4",
"express-less": "0.0.7", "express-less": "0.0.7",
"jade": "^1.11.0", "jade": "^1.11.0",
"mongodb": "^1.4.38", "mongodb": "^1.4.38",
"mongoskin": "^1.4.13" "mongoskin": "^1.4.13",
} }
} }

22
web.js
View file

@ -1,12 +1,14 @@
//web.js //web.js
var config = require('./configuration');
var express = require('express'); var express = require('express');
var less = require('express-less'); var less = require('express-less');
var app = express(); var body_parser = require('body-parser');
var config = require('./configuration');
var lookup = require('./lookup'); var lookup = require('./lookup');
var schedule = require('./schedule'); var schedule = require('./schedule');
var app = express();
//Set up jade rendering engine. //Set up jade rendering engine.
app.set('view engine', 'jade'); app.set('view engine', 'jade');
config().env == 'dev' ? app.disable('view cache') : null; //If the environment is set on 'dev' then view cache should be disabled. config().env == 'dev' ? app.disable('view cache') : null; //If the environment is set on 'dev' then view cache should be disabled.
@ -18,26 +20,26 @@ app.use('/js', express.static(__dirname + '/resources/js'));
app.use('/other', express.static(__dirname + '/resources/other')); app.use('/other', express.static(__dirname + '/resources/other'));
app.get('/', function (req, res) { app.get('/', function (req, res) {
req.links = config().links; req.links = config().links;
res.render('homepage', req); console.log(req.user);
res.render('homepage', req);
}); });
app.get('/rooster/:search', function (req, res) { app.get('/rooster/:search', function (req, res) {
next(); next();
}); });
app.get('/over', function (req, res) { app.get('/over', function (req, res) {
res.send('Hier kun je lezen over werkmanrooster.'); res.send('Hier kun je lezen over werkmanrooster.');
}); });
app.param('search', lookup); app.param('search', lookup);
app.param('search', schedule); app.param('search', schedule);
app.param('search', function (req, res) { app.param('search', function (req, res) {
req.links = config().links; req.links = config().links;
req.times = config().hour_times; req.times = config().hour_times;
res.render('schedule', req); res.render('schedule', req);
}); });
app.listen(config().web_port); app.listen(config().web_port);