Skip to content

Commit

Permalink
Redis key now is string value
Browse files Browse the repository at this point in the history
  • Loading branch information
SunPj committed Jun 29, 2016
1 parent 812710a commit 3dccd8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/com/example/Server.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ object Server {

val route: Route =
get {
pathPrefix("get" / LongNumber) { key =>
pathPrefix("get" / Remaining) { key =>
// there might be no item for a given id
val maybeItem: Future[Option[ByteString]] = redis.get(key.toString)
val maybeItem: Future[Option[ByteString]] = redis.get(key)

onSuccess(maybeItem) {
case Some(item) => complete(HttpEntity(ContentTypes.`application/json`, s"""{"key": $key, "value": "${item.utf8String}"}"""))
Expand Down

0 comments on commit 3dccd8b

Please sign in to comment.