Merge pull request #13 from Patreon/luke---remove-things

Remove unused directories and functions.
This commit is contained in:
Luke Davis 2016-12-21 14:14:20 -08:00 committed by GitHub
commit 2d41d8c636
2 changed files with 2 additions and 24 deletions

View file

View file

@ -3,6 +3,7 @@ try {
} catch (e) { } catch (e) {
console.error("WARNING unable to load newrelic") console.error("WARNING unable to load newrelic")
} }
var fs = require('fs'); var fs = require('fs');
var express = require('express'); var express = require('express');
var uuid = require('uuid/v4'); var uuid = require('uuid/v4');
@ -21,31 +22,8 @@ function composeImage(width, height, seed) {
return canvas; return canvas;
}; };
function writeFoxToDisk (canvas, nameSuffix) {
var fileName = "fox-" + nameSuffix + ".png";
var filePath = __dirname + '/images/' + fileName;
fs.writeFile(filePath, canvas.toBuffer(), function(err) {
if (err) console.log('error', err);
});
return fileName;
};
function writeFoxesToDisk (width, height, n=10) {
var fileNames = [];
for (var i = 0; i < n; i++) {
var seed = uuid();
var canvas = composeImage(width, height, seed);
fileNames.push(writeFoxToDisk(canvas, seed));
}
return fileNames;
};
var app = express(); var app = express();
app.use(express.static(__dirname + '/images'));
var cacheTimeout = 60 * 60 * 24 * 30; var cacheTimeout = 60 * 60 * 24 * 30;
app.get('/healthcheck', function(req, res) { app.get('/healthcheck', function(req, res) {