diff --git a/server.js b/server.js index ab7baa8..8672988 100644 --- a/server.js +++ b/server.js @@ -42,25 +42,24 @@ var app = express(); app.use(express.static(__dirname + '/images')); app.get('/', function(req, res) { - var fileNames = writeFoxesToDisk(200, 200, 28); - var images = fileNames.map(fileName => ''); - res.send(images.join('')); + var width = 400; + var seed = uuid(); + var canvas = composeImage(width, width, seed); + res.end(canvas.toBuffer(), 'binary'); }); app.get('/:width', function(req, res) { var width = parseInt(req.params.width) || 400; var seed = uuid(); var canvas = composeImage(width, width, seed); - var fileName = writeFoxToDisk(canvas, seed); - res.send(''); + res.end(canvas.toBuffer(), 'binary'); }); app.get('/:width/:seed', function(req, res) { var width = parseInt(req.params.width) || 400; var seed = sanitize(req.params.seed) || uuid(); var canvas = composeImage(width, width, seed); - var fileName = writeFoxToDisk(canvas, seed); - res.send(''); + res.end(canvas.toBuffer(), 'binary'); }); app.listen(process.env.PORT || 3000);