On Sat, 14 Sep 2013 13:58:55 GMT, simendsjo wrote:
Hi. I got time to play a bit with UDAs and vibe, and while this isn't much, I think the possibilities for more declarative code looks good.
module myapp; mixin CurrentModule; @(page.get("/")) void index(HTTPServerRequest req, HTTPServerResponse res) { res.renderCompat!"index.dt"(); } shared static this() { auto router = new URLRouter(); router.addRoutesFromMembersOf!__CurrentModule; }
Notice
@(page.get"/")
andaddRoutesFromMembersOf!__CurrentModule
.Next up is trying to fix UDAs for the inject pattern. Hopefully I can write the following
@(page.get("/")) @(requires!(userLoggedIn, hasRights!(addUser))) void add_user(Params...)( // etc
Is anyone else playing around with UDAs and vibe?
Oops.. the @page
should be @route