RouterGroup
Used to group together routes under a single path. Additional middleware can be added to the endpoint and each route can add a suffix to the endpoint path
struct RouterGroup<Context> where Context : RequestContext
The code below creates an RouterGroup
with path “todos” and adds GET and PUT routes on “todos” and adds GET, PUT and DELETE routes on “todos/:id” where id is the identifier for the todo
app.router
.group("todos")
.get(use: todoController.list)
.put(use: todoController.create)
.get(":id", use: todoController.get)
.put(":id", use: todoController.update)
.delete(":id", use: todoController.delete)