Vibe.d web interface tutorial

Steven Schveighoffer schveiguy at yahoo.com
Tue Mar 13 10:12:24 UTC 2018


On 3/9/18 11:34 AM, aberba wrote:
> On Friday, 9 March 2018 at 16:32:28 UTC, aberba wrote:
>> New blog post for the learning audience
>>
>> aberba.com/2018/using-vibe-d-web-interface
> 
> http://aberba.com/2018/using-vibe-d-web-interface
> 

Very nice! Although this is missing one of my favorite vibe.d web 
interface features -- automatic parsing of route parameters:


class WebInterface
{
    void getRoute(HTTPServerResponse res, int foo, Nullable!int bar)
    {
        import std.format;
        res.writeBody(format("foo = %s, bar = %s", foo, bar));
    }
}

/route => Error, foo required
/route?foo=1 => "foo = 1, bar = Nullable.null"
/route?foo=2&bar=5 => "foo = 1, bar = 5"

-Steve


More information about the Digitalmars-d-announce mailing list