Less Verbose way of generating Play 2's javascript router

Viewed 1452

Currently I define my app's javascript router in a fairly verbose way

def javascriptRoutes = Action { implicit request =>
  import routes.javascript._
  Ok(Routes.javascriptRouter("jsRoutes")(
    Login.method1,Login.Method2,
    OtherController.method1,OtherController.method2,
    //[...]
  )).as("text/javascript")
}

What I really would like to do is to create a javascriptRouter with all of the routes in the routes file, so I don't have to manually update the javascriptRoutes definition each time I add a new controller method.

Is there a way to accomplish this task, or is there even a slightly less verbose way of defining the javascriptRouter?

5 Answers
Related