2015-06-24 12:30:43 +02:00
|
|
|
//web.js
|
|
|
|
var express = require('express');
|
|
|
|
var less = require('express-less');
|
2015-08-24 12:29:06 +02:00
|
|
|
var hoewerkt = require('./hoewerkt');
|
2015-06-29 23:40:40 +02:00
|
|
|
var fs = require('fs');
|
2015-06-24 12:30:43 +02:00
|
|
|
var app = express();
|
|
|
|
|
|
|
|
//Set up jade rendering engine.
|
|
|
|
app.set('view engine', 'jade');
|
|
|
|
app.disable('view cache');
|
|
|
|
app.set('views', __dirname + '/resources/jade');
|
|
|
|
|
|
|
|
//Set up all static directories for getting resources.
|
2015-06-29 23:40:40 +02:00
|
|
|
app.use('/css', less(__dirname + '/resources/less', {debug : true}));
|
2015-06-24 12:30:43 +02:00
|
|
|
// app.use('/js', express.static(__dirname + '/resources/js'));
|
2015-06-29 23:40:40 +02:00
|
|
|
app.use('/images', express.static(__dirname + '/resources/images'));
|
2015-06-30 11:25:25 +02:00
|
|
|
app.use('/other', express.static(__dirname + '/resources/other'));
|
2015-06-24 13:01:17 +02:00
|
|
|
//Setup markdown middleware.
|
2015-06-24 12:30:43 +02:00
|
|
|
|
2015-08-24 12:29:06 +02:00
|
|
|
app.get('/', hoewerkt);
|
|
|
|
app.get('/:article', hoewerkt);
|
2015-06-24 12:30:43 +02:00
|
|
|
|
2015-10-06 08:39:12 +02:00
|
|
|
function start(port, host) {
|
|
|
|
app.listen(port, host);
|
2015-06-26 12:05:05 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = start;
|
2015-06-29 18:31:46 +02:00
|
|
|
|
|
|
|
if (process.argv[2] == 'standalone') start(1024);
|