#1 Re: mORMot 1 » What is the difference between TSQLRestServer and TSQLHttpServer? » 2017-04-30 18:39:58

Thank you very much. Thanks again!
I finally got the right result:
{"result": [5]}
At the same time, I had read this rules, I am sorry, I will delete this code, and then go to bed.
Finally I can sleep, only 3 hours on the sun will come out... ...
Thanks ~

#2 Re: Language » Interfaces IS and AS » 2017-04-30 18:12:04

About is and as, I think the difference is as follows :
v:=obj is TObj   (true)  ; v:=obj is TOtherObj (false)
v:= obj as TObj (v is a instance of TObj class ) ; v:= obj as TOtherObj (v is nil )

if TObj and TOtherObj has a same of parent class:
v:=obj is TParent  (true)  ; v:=obj is TParent (true)

v:= obj as TParent (v is a instance of TParent class ) ; v:= obj as TParent (v is a instance of TParent class )

#3 Re: mORMot 1 » What is the difference between TSQLRestServer and TSQLHttpServer? » 2017-04-30 17:51:58

In the browser:
Http://localhost:8888/web/index.html
Is ok!
Http://localhost:8888/api/add? A=2&b=322
Will get error code 400. ROOT_NAME='API'.

#4 Re: mORMot 1 » What is the difference between TSQLRestServer and TSQLHttpServer? » 2017-04-30 17:47:56

igors233 wrote:

> TSQLRestServer can also provide HTTP services alone, and don't need TSQLHttpServer?
> maybe i want to know if they have any connection or difference.

No, TSQLRestServer is about implementing your business logic, while SQLHttpServer is about transporting data from Client to Server.

You should have your business written with help of  one of RestServer descendants  (take a look at section 11.1.1. in docs), after that comes question how to make that RestServer available to clients, or how to publish it.
It's usually through TCP/IP (TSQLHttpServer for example), but you can also have local access (both client and server are on local machine) established with pipes or windows messages. Take a look at 11.2, 11.3, 11.4 section in docs.


Thank you very much.
I've started using mORMot to write code.
I've been reading documents and forums these days.
At the moment I have a problem, I added a add method, created by Interface, and has been properly registered.
But when I visited with a browser, I still went wrong:
{
"ErrorCode": 400,
"ErrorText": "Bad Request""
}
I'm sure I will set the permissions for httpserver and restserver to none.
And I can get the static files I need in httpserver's Request.
Part of the code is as follows:

the Interface unit and TSQLUserRecord unit is the same as  document.
I know I may have asked a stupid question, but as a beginner, what I need most now is my  demo to run properly, and then I can do all the functions on it!

#5 Re: mORMot 1 » What is the difference between TSQLRestServer and TSQLHttpServer? » 2017-04-29 16:11:34

tks,I know. but maybe I want to ask is :
TSQLRestServer can also provide HTTP services alone, and don't need TSQLHttpServer?
oh....
maybe i want to know if they have any connection or difference.
I think it's very important for a newbie.
Thanks again~

#6 Re: mORMot 1 » What is the difference between TSQLRestServer and TSQLHttpServer? » 2017-04-29 08:28:35

If i want to add a method name of Pow(integer x;integer y):integer.
I can add it in TSQLRestServerCustom(TSQLRestServer ),or add it in OnRequest of TSQLHttpServerCustom(TSQLHttpServer).
I don't know where is the different?
tks.

#7 mORMot 1 » What is the difference between TSQLRestServer and TSQLHttpServer? » 2017-04-29 08:13:17

rcyboom
Replies: 8

I am a newbie, these days I have been reading documents and forums.
There is a problem has been bothering me for a long time, would like to ask about.
What is the difference between TSQLRestServer and TSQLHttpServer?
I think TSQLHttpServer mainly provides http protocol communication and control, TSQLRestServer is mainly to provide database-based REST services.
Then, the document has a reference to the Publishing a service on the server, I understand that the addition of a REST method.
But for the benefit and limitations of this implementation, ,the interface is for public service on the server and the client.
So, can I add a Sum method to the TSQLHttpServer ? do not increase the method in TSQLRestServer to achieve the purpose of it?
Or that can only  overwrite its OnRequest method and analysis the URL to do?Such as Project04ServerStatic.
Very sorry for my English, which is translated with google.:D

Board footer

Powered by FluxBB