Vibe.d web interface tutorial
aberba
karabutaworld at gmail.com
Tue Mar 13 20:42:49 UTC 2018
On Tuesday, 13 March 2018 at 10:12:24 UTC, Steven Schveighoffer
wrote:
> 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
I don't know why but I dont really use that feature often. I tend
to access them with req.query.get("param") and
req.form.get("param") directly. Don't know why... time to save
some key strokes. ...but how does file handling work with this
approach? input(type="file"...)
More information about the Digitalmars-d-announce
mailing list