var path = require('path'); var fs = require('fs'); var model; exports.setModel = function(m) { model = m; }; exports.start = function(config) { config.app.get('/slides/:id', function(req, res) { var slideset; slideset = req.params.id; model.getSlides(slideset, function(err, slides) { if(err) { throw err; } fs.readFile(path.join(__dirname, config.dir, slides['template']) , function(err,data) { if(err) { res.end(body); } var body = data.toString(); var slideStr = ''; for(var slide in slides['slides']) { if(!slides['slides'].hasOwnProperty(slide)) { continue; } if(slides['slides'][slide]['type'] === 'image') { slideStr = slideStr +'