#1 2016-02-19 14:59:56

automacaosamos
Member
Registered: 2015-02-19
Posts: 20

Object JSON sent with method POST by mormot

I'm sending an object JSON with the POST method by ExtJs 6.01.
the object is inside request payload or (http request body).
I would like to capture the object with class(TSQLHttpServer) is possible?

Offline

#2 2016-02-19 16:25:42

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

Re: Object JSON sent with method POST by mormot

It is pretty easy using a method-based service.
See http://synopse.info/files/html/Synopse% … ml#TITL_49

Offline

#3 2016-02-20 17:15:48

automacaosamos
Member
Registered: 2015-02-19
Posts: 20

Re: Object JSON sent with method POST by mormot

sorry my little experience, but I use ExtJs 6.01 as a customer.
would like to access a method with serverservice not have PORTNUMBER
http://localhost:8050/root/myobjectJSON

Offline

#4 2016-02-21 16:33:11

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

Re: Object JSON sent with method POST by mormot

Create a

published
  procedure MyObjectJSON(Ctxt: TSQLRestServerURIContext);
end;

as documented.

See e.g. https://github.com/synopse/mORMot/blob/ … Server.dpr
and return your JSON content using TSQLRestServerURIContext.Returns() method.

Offline

#5 2016-02-22 17:58:08

automacaosamos
Member
Registered: 2015-02-19
Posts: 20

Re: Object JSON sent with method POST by mormot

thanks.

sorry if it's a stupid question.
but the example:
https://github.com/synopse/mORMot/blob/ … Server.dpr
there is not a port number
as you would in the browser?
http://localhost:8050/root/sum  ??

Offline

#6 2016-02-22 18:07:30

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

Re: Object JSON sent with method POST by mormot

The sample uses named pipe, indeed.
See the doc and other samples (like sample 04) for how HTTP servers are published with mORMot.
http://synopse.info/files/html/Synopse% … #TITLE_247

Offline

Board footer

Powered by FluxBB