'What does Action mean in play framework (Scala)?
I am new to Play Framework and was trying to understand SimpleRouter class. In the Play documentation, I see a simple example as:
val router = Router.from {
case GET(p"/hello/$to") =>
Action {
Results.Ok(s"Hello $to")
}
}
But I am not sure what is Action and what is its significance? I see it heavily used in all other routing methods as well. Here's the link to the documentation: https://www.playframework.com/documentation/2.8.x/ScalaSirdRouter

My reference code:
import play.api.mvc._
import play.api.routing.Router._
import play.api.routing._
import play.api.routing.sird._
class CacheRouter extends SimpleRouter {
override def routes: Routes = {
case GET(p"/") =>
Action {
Results.Ok(s"Hello")
}
// case POST(p"/") =>
// controller.process
//
// case GET(p"/$id") =>
// controller.show(id)
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
