#1 2014-09-03 14:07:15

vladon
Member
From: Naberezhnye Chelny
Registered: 2014-09-03
Posts: 8
Website

Very very simple REST server example

I started to study mORMot and need an example of very simple REST server, which for example binds on port 8080, and on request GET http://localhost:8080/api/test replies with something like:

{
 "status": "OK",
 "description": "Test succeeded",
 "statusCode": 200,
 "data": null
}

Or how to process REST requests not mapping them to sqlite base, as in Example #28 (Simple RESTful ORM Server).


Could someone help me, please? Big thanks in advance.

Offline

#2 2014-09-03 18:02:23

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

Re: Very very simple REST server example

See sample "06 - Remote JSON REST Service" for a method-based RESTful services.

And sample "14 - Interface based services" for interface-based RESTful services.

Use 'api' as root to the TSQLModel, and name the method "test":

procedure TServiceServer.Test(Ctxt: TSQLRestServerURIContext);

Offline

Board footer

Powered by FluxBB