vib.d suppress 404 for no content written

Seb seb at wilzba.ch
Wed Feb 14 21:50:34 UTC 2018


On Wednesday, 14 February 2018 at 21:16:23 UTC, aberba wrote:
> Seb,  are you the one doing the vibe.d demo collections?

Do you mean this?

https://github.com/wilzbach/vibe-d-by-example

Yes, that's me, but it still needs a lot of work and I haven't 
got around polishing it for an alpha "release", but the examples 
there should be fully functional with ~>vibe.d-0.8.3-alpha.1

BTW I also have a fork of vibe.web.web at 
https://github.com/teamhackback/hb-web which adds all the 
convenience features that I haven't been able to get upstream so 
far [1].
A short overview of what I miss in vibe.web.web:

---
class Service {

     // Returning strings (instead of res.writeBody)
     string getString() { return "string"; } // 
https://github.com/vibe-d/vibe.d/pull/1854

     // Access to Json
     auto postJson(Json _json) { return _json; } // 
https://github.com/vibe-d/vibe.d/pull/1853

     // Automatically serialize data types
     auto postStruct(MyStruct st) { return st.foo + 3; } // 
https://github.com/vibe-d/vibe.d/pull/1697

     // https://github.com/vibe-d/vibe.d/pull/1698
     // @path is automatically set to /user/:id
     // works for all _-prefixed variables that don't have any 
inference yet (i.e. _error still works)
     void getUser(string _id, HTTPServerResponse res) {
         res.writeBody("User: " ~ _id);
     }
}
---


Though to be fair, things improved a bit in Vibe.d 0.8.2 and 
`request` and `response` are now available.
They refer to current request.


[1] https://github.com/vibe-d/vibe.d/pulls/wilzbach


More information about the Digitalmars-d-learn mailing list