D For A Web Developer
Rikki Cattermole via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 30 03:01:50 PDT 2014
On Wednesday, 30 April 2014 at 09:41:36 UTC, Dicebot wrote:
> On Wednesday, 30 April 2014 at 04:21:20 UTC, Rikki Cattermole
> wrote:
>>> Having a quick look at Cmsed I must admit I like plain vibe.d
>>> much more despite the added features :( Forced module
>>> coupling and OO-heavy design is big loss compared to design
>>> simplicity and independence of base vibe.d modules.
>>>
>>> For example I can't imagine a single case when I'd prefer
>>> class-based route definition to stock delegate-based.
>>
>> The classes are unfortunately just a container for routes. So
>> if you got a better way, that can provide the same
>> functionality, I'd love for a plan on how to do it!
>>
>> Basically my idea is that you register as little as possible.
>> That was why I went with a class for routes.
>>
>> I'm really gunning for less, simpler = more. And for
>> medium-large sites thats kinda important.
>
> Why can't stand-alone annotated function be a valid route?
> Route is pretty much method + url + handler and first two can
> be inferred by convention in many cases (as done in
> vibe.web.rest & Co).
The only way I know of that doesn't result in a container is
registerRoutes!"mymodule"; Instead of registerRoute!MyRoute;
Now if I could get access to a list of all the modules and hence
all routes at CTFE then that wouldn't be an issue. Same deal for
models.
Basically give me a way that doesn't impose upon the user to
manually register a route and the symbol is available at CTFE,
then I'll use it.
I just don't know it.
There is some benefits of having a container for routes however.
Being able to add UDAs to that group of routes. I.e. Don't
generate javascript, give them a name/grouping.
While its possible without it, its a bit more distinct.
More information about the Digitalmars-d
mailing list