#1 2023-02-24 21:56:49

mrbar2000
Member
From: Brazil
Registered: 2016-10-26
Posts: 56

A framework RESTFULL using Interfaces

Hi Guys,

I starting develop mormot using mormot2.
I trying build a ticket system as prove of concept.

I had read this topics and I would like know why not can use PUT/DELETE with SOA interfaced based?
https://synopse.info/forum/viewtopic.php?id=1833

Congratulations for the Server.Route.Get/Post/Put/Delete article. I'm using this approach.
But do not works to DELETE/PUT

Server.Route.Get('/projeto/<id>', 'root/find/<id>');  // works
Server.Route.Delete('/projeto/<id>', 'root/delete/<id>');  // dont works

Why Route DELETE cannot get the instace of service and call your delete(id: integer) method as the GET does?

And some base classe that implements IInvokable could expose a virtual method called DoRequest(Ctxt: TRestServerUriContext)? so the programmer could be treat others situations not implemented by mormot!


What you think?

Offline

#2 2023-02-25 07:50:24

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,207
Website

Re: A framework RESTFULL using Interfaces

For DELETE/PUT please try with the following:
https://github.com/synopse/mORMot2/commit/2f805827

For procedure TMyServer.MyMethod(Ctxt: TRestServerUriContext) what I propose is to let the framework recognize the signature and run it as a method-based service.

Offline

Board footer

Powered by FluxBB