mirror of
https://git.sleeping.town/mirrors/foxy-moxy
synced 2024-11-24 04:57:42 +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) {
|
} 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,35 +22,12 @@ 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) {
|
||||||
res.status(200).end();
|
res.status(200).end();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/:width/:seed', function(req, res) {
|
app.get('/:width/:seed', function(req, res) {
|
||||||
|
|
Loading…
Reference in a new issue