I guess, in Play 2.4, you would inject the router:
class Health @Inject() (router: Router) extends Controller {
def doc = Action { implicit request =>
val myroutes = router.documentation.map {
x => Json.obj("http_method" -> x._1, "path" -> x._2, "scala" -> x._3)
}
Ok(Json.obj("k" -> myroutes))
}
}
But, this is not really a good API documentation. You don't get, what stuff you have to POST, or what stuff you will GET.
Still wondering, if there ist a better way to get a REST-API documentation out of play...