Release: serverino - please destroy it.
Andrea Fontana
nospam at example.org
Tue May 10 19:34:03 UTC 2022
On Tuesday, 10 May 2022 at 18:33:18 UTC, Sebastiaan Koppe wrote:
> On Tuesday, 10 May 2022 at 10:49:06 UTC, Andrea Fontana wrote:
>> On Tuesday, 10 May 2022 at 08:32:15 UTC, Sebastiaan Koppe
>> wrote:
>>> The difference is that with the route uda you can *only* map
>>> routes 1:1 exhaustively. With your approach it is up to the
>>> programmer to avoid errors. It is also hard to reason about
>>> the flow of requests through all those functions, and you
>>> have to look at the body of them to determine what will
>>> happen.
>>
>> Sorry I don't follow you
>
> It is simple, since all your handler are effectively chained,
> any error in any one of them can cause later ones to fail or
> misbehave. This decreases locality and increases the things you
> have to reason about.
Not sure. What if your uda (regex) match is too permissive? Is
that different?
My code evaluates workers in order, just like yours, no?
Maybe I can enable some log if set on config, to track what's
happening. That could help you to debug if something goes wrong.
>
> There are other benefits to uda tagged endpoints too, for
> example they are easier to nest, or to programmatically
> generate them. In vibe-d I added the default option of
> generating OPTION handlers for every regular endpoint. This is
> required for CORS.
@endpoint void func(...){
if(req.method == Method.OPTION){
// THIS RUN FOR EVERY ENDPOINT
}
}
>
>> In any case if you want to use a different routing strategy
>> it's quite easy. I really don't like libraries that force you
>> to use their own style/way.
>
> That is good.
Andrea
More information about the Digitalmars-d-announce
mailing list