Skip to content

Commit d0fb473

Browse files
committed
Added new route for the random endpoint
1 parent 53068fe commit d0fb473

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/routes/avatars.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Router from 'express';
2+
import uuid from 'uuid'
23

34
import {
45
allNames,
@@ -42,6 +43,16 @@ router.get('/:size/:id', function(req, res, next) {
4243
});
4344
});
4445

46+
router.get('/:size?/random', function(req, res) {
47+
var faceParts;
48+
faceParts = potato.parts(uuid.v4());
49+
req.faceParts = faceParts;
50+
51+
return combine(faceParts, req.params.size, function(err, stdout) {
52+
return common.sendImage(err, stdout, req, res);
53+
});
54+
});
55+
4556
router.get('/face/:eyes/:nose/:mouth/:color/:size?', function(req, res, next) {
4657
let faceParts = { color: '#' + req.params.color };
4758

0 commit comments

Comments
 (0)