3d-interface/server/controllers/stream/index.js

26 lines
732 B
JavaScript
Raw Permalink Normal View History

var tools = require('../../lib/filterInt');
2015-05-05 11:56:35 +02:00
module.exports.index = function(req, res, next) {
// Parse get argument res
res.locals.resolution = req.params.res;
if (res.locals.resolution === undefined) {
res.locals.resolution = 5;
} else {
res.locals.resolution = tools.filterInt(res.locals.resolution);
}
if (isNaN(res.locals.resolution) || res.locals.resolution < 1 || res.locals.resolution > 25) {
var error = new Error("Resolution was not set properly");
error.status = 404;
next(error);
return;
}
res.setHeader('Content-Type', 'text/html');
2015-05-05 16:30:51 +02:00
res.render('index.jade', res.locals, function(err, result) {
2015-05-05 11:56:35 +02:00
res.send(result);
});
};