[fpc-pascal] fpWeb REST support (asking about features)
michael.vancanneyt at wisa.be
michael.vancanneyt at wisa.be
Tue Jun 7 09:41:59 CEST 2011
On Tue, 7 Jun 2011, ik wrote:
> Hello,
>
> One of the thing that I find really missing in fpWeb is the ability to have
> support for REST.
>
> That is, to place different callbacks to GET, POST, UPDATE, DELETE, HEAD and
> PUT.
Why do you think this is missing ? fpWeb does not really care about the method.
> Let's say that I create a support for the following PATH_INFO:
>
> /records/
>
> The class should have support imho to OnGet OnPost OnDelete etc..
> So there will be separation of the code, while the OnRequest will fire
> anyway (if assigned) prior to each such request.
> That way, it will be easier to separate code, but remain DRY.
What is DRY (other than opposed to WET ?)
>
> Does anyone else find such feature something that can be useful for them ?
All you need to do is
If Compare(ARequest.Method,'UPDATE') then
DoYourUpdate(ARequest);
If you really want different events for the HTTP methods, you can make a
descendent of TCustomHTTPModule which overrides HandleRequest() and which then
examines the HTTP method and calls the appropriate callback for the various HTTP
methods.
It can't possibly take you more than 15 minutes to code this, plus an
additional 10 to register your new module in Lazarus.
And if you care to donate it, I'll put it in FPC.
Michael.
More information about the fpc-pascal
mailing list