Open v79 opened 7 years ago
It would be useful to support path groups. I've split my code into separate controllers, like so:
class UserController : AbstractController() { val users: MutableList<User> = mutableListOf() init { get("/users") { val model: MutableMap<String,List<User>> = hashMapOf<String,List<User>>() model.put("users",users) engine.render(ModelAndView(model,"users")) } post("/users/add-submit") { val u:User = User(request.queryParams("name"),request.queryParams("age").toInt()) users.add(u) redirect("/users") } } }
Being able to use paths could reduce code duplication:
init { path("/users") { get("/") { // e.g. /users/ } get("/add") { // e.g. /users/add } post("/submit") { // e.g. /users/submit } } }
We'll try to get this into our official release!
Did you include it in the official release?
It would be useful to support path groups. I've split my code into separate controllers, like so:
Being able to use paths could reduce code duplication: