Sendero Routing Framework
Reference
Class Decorator @controller
Function Decorators:
- @GET
- @POST
- @PUT
- @DELETE
- @ALL
Params: String pathToken/Array of Strings pathTokens (optional)
Special Method Names: __index__, __list__, __show__, __wildcard__
Special Path Tokens: "/" - root, "*" - wildcard
Standalone Decorators
- @continue(String pathToken, String controllerName)
Special function signatures
- static IIController getInstance(Req req);
Example
@controller class MainController { @GET static void __index__(Req req) { } @continue("user","UserController"); } @controller class UserController { this(User user) { this.user = user; } private User user; @GET static void __list__(Req req) { } @GET static void create(Req req) { } @POST static void doCreate(Req req) { } static IIController getInstance(Req req) { auto user = User.findByID(Int.parse(req.token)); return new UserController(user); } @GET void __show__(Req req) { } @GET void edit(Req req) { } @POST void save(Req req) { } }
