mirror of
https://git.sleeping.town/mirrors/foxy-moxy
synced 2024-11-13 23:47:43 +00:00
Merge pull request #13 from Patreon/luke---remove-things
Remove unused directories and functions.
This commit is contained in:
commit
2d41d8c636
2 changed files with 2 additions and 24 deletions
26
server.js
26
server.js
|
@ -3,6 +3,7 @@ try {
|
|||
} catch (e) {
|
||||
console.error("WARNING unable to load newrelic")
|
||||
}
|
||||
|
||||
var fs = require('fs');
|
||||
var express = require('express');
|
||||
var uuid = require('uuid/v4');
|
||||
|
@ -21,35 +22,12 @@ function composeImage(width, height, seed) {
|
|||
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();
|
||||
|
||||
app.use(express.static(__dirname + '/images'));
|
||||
|
||||
var cacheTimeout = 60 * 60 * 24 * 30;
|
||||
|
||||
app.get('/healthcheck', function(req, res) {
|
||||
res.status(200).end();
|
||||
res.status(200).end();
|
||||
});
|
||||
|
||||
app.get('/:width/:seed', function(req, res) {
|
||||
|
|
Loading…
Reference in a new issue