You are not logged in.
Pages: 1
Hi All,
I am new to mORMot and I have a lot a small Object Pascal command line applications I developed over the years and normally use for my job. Now, as I discovered mORMot, I think it is a good idea to use them as CGI applications using this wonderful framework, so I wonder if there is already a small example about how to use CGI apps with mORMot, or at least some hints. Thank you.
Offline
I do not understand how CGI may help...
Why not just call the external command line applications from a mORMot interface-based server, or - even better - reuse the small Object Pascal command line applications within a mORMot interface-based server directly?
Offline
I do not understand how CGI may help...
reuse the small Object Pascal command line applications within a mORMot interface-based server directly?
Could you please give me a small example, or just a hint, seen I am very new to mORMot. Given I have myapp.exe...
Thank you.
Offline
Well, with the good old xitami web server I did something like this:
program summing;
{$APPTYPE CONSOLE}
uses
SysUtils, cgi;
var
x, y, z: double;
tempStr: string;
function sum(a, b: double): double;
begin
result := a+b;
end;
function FormFloat(s: string): double;
begin
// read the name and the value of the input data from a HTML form sent by the browser
// and return the value as a double
end;
begin
x := FormFloat('name1');
y := FormFloat('name2');
z := x+y;
tempStr := FloatToStr(z);
// send the data to the browser
writeln(tempStr);
end.
What I want is to do is, more or less, something like this using mORMot.
Seen mORMot is huge, what are the important parts to learn first to write this kind of applications? Thank you.
Offline
For writing standard web/REST operations, I guess you may just try to define some method-based services.
See http://synopse.info/files/html/Synopse% … DE_TITL_49
and https://github.com/synopse/mORMot/tree/ … %20Service
As an alternative, especially if you want to have Delphi clients or AJAX clients, you may try interface-based services.
See http://synopse.info/files/html/Synopse% … ml#TITL_63
and https://github.com/synopse/mORMot/tree/ … 20services
Take also a look at https://tamingthemormot.wordpress.com/
Offline
Pages: 1