I am working with the spray api. I have the following code:
import akka.actor.ActorSystem
import spray.routing.SimpleRoutingApp
import spray.json.DefaultJsonProtocol._
object Server1 extends App with SimpleRoutingApp{
implicit val actorSystem = ActorSystem()
startServer(interface="localhost",port = 8080){
println("Listening...")
get{
println("incoming..")
path("state"){
complete{
"in the complete block"
}
}
}
}
}
It is giving a single response on api. It will print "in the complete block" when i call from web browser. Can I make it iterative means that i use a variable and send its value in complete block then I can change the value of that variable and then send its new value in complete block.