Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Save uploaded image to path and then associate unique ID with the path.

  • Loading branch information...
commit 33af0ae776fd78d2d03fbef17fea5c3ffc98510f 1 parent dc77742
@nikhilm authored
Showing with 14 additions and 2 deletions.
  1. +14 −2 server.js
View
16 server.js
@@ -78,7 +78,13 @@ function handleUrl(request, response) {
})
.on('end', function() {
stream.on('close', function() {
- reply(face.faces(stream.path), response);
+ addToRedis(stream.path, function(err, id) {
+ // we aren't concerned about the error
+ // because we can always reply with
+ // the list of faces right now even
+ // if we can't cache it
+ reply(face.faces(stream.path), id, response);
+ });
});
stream.end();
})
@@ -98,7 +104,13 @@ function handleFile(request, response) {
request.on('error', console.log);
request.on('end', function() {
stream.on('close', function() {
- reply(face.faces(stream.path), response);
+ addToRedis(stream.path, function(err, id) {
+ // we aren't concerned about the error
+ // because we can always reply with
+ // the list of faces right now even
+ // if we can't cache it
+ reply(face.faces(stream.path), id, response);
+ });
});
stream.end();
});
Please sign in to comment.
Something went wrong with that request. Please try again.