On Fri, 09 May 2014 06:29:36 GMT, Darius Clark wrote:

Hi,

I would like to ask about registerFormInterface(). I read several examples (including whats in the unittest) but I would like to get a clear answer:

First off, for new code, I'd strongly recommend to use the newer vibe.web.web module, if possible, which is basically a re-implementation of the form interface module, but based on the same generic foundation as the rest interface module. registerFormInterface will get deprecated and removed at some point (not in the near future, though).

However, the new module doesn't yet have all the features available. Most notably, struct type parameters are not yet properly projected as form fields. I'll add some missing functionality and some examples in the coming days, when I port one of my projects to use it.

  1. Does the registerFormInterface makes it so that if I want todo a GET or a POST, I have to do something like class app{void getAccount(...){res.render!("account.dt", req);}} and access it by doing http://example.com/account ? I mean does it turn the account.dt into a accessible page for GET or POST or am I missing something?

That's right. The vibe.web.web module would just add a route for GET (according to the method prefix), while the registerFormInterface would accept both, GET and POST.

  1. Is there a performance difference when using registerFormInterface compare do just registering each url by doing auto router = new URLRouter; router.get("/account",&account); ?

No, they should be more or less exactly the same.

  1. How customizible is the registerFormInterface other than what the examples show? Is there a easier way than using registerFormInterface possibly with user defined annotations to define the url, http method, before the function?

vibe.web.web supports this using @method and @path annotations (see the documentation of vibe.web.rest for some examples). It also has some additional features, such as defining an InputStream parameter that gets the raw request body, returning an InputStream that is used to source the response body, and support for session local variables. There is also a little example project, which shows the basic usage.

Thank you and sorry if Im not clear. I am typing this late at night because I am still porting more of my code from node.js to vibe.d.

That noble goal definitely excuses everything ;) Let me know if anything is missing.