Hi everyone,
I am trying to get a simple async example route going. Coming from a background of NodeJS, I am having a bit of a hard time understanding using callbacks AND having a return value.
def asyncTest = Action {
val willBeInt = Future {
Thread.sleep(5000)
100
}
willBeInt.onComplete({
case Success(value) => Ok(s"Value = $value")
case Failure(e) => Failure(e)
})
}
This results in a compile-time error:
Overloaded method value [apply] cannot be applied to (Unit)
If someone could point me in the right direction, that would be awesome!
Thanks