Recent

Author Topic: mORMot1 (2) Acting like CGI  (Read 676 times)

BSaidus

  • Hero Member
  • *****
  • Posts: 665
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
mORMot1 (2) Acting like CGI
« on: October 30, 2025, 09:18:31 am »
Hello.
Are there any peoples or @abouchez who can help (expliaine) me, giving exemple or enlightements about my requests.
  - Is mORMot capable to act as a .cgi program ?
Giving a desktop application written with lazarus/fpc which interact with some http server supporting cgi (Apache, ...) using mORMot:
  I work with data (from Db) in my desktop application, then while saving, the data will be posted to remote server (Apache) that executes the ".CGI application,
  the ".CGI" program will intercept tha data sent by me and save them to ".DB". After saving I need to do some calculus (works) depending on this data.
 
  The classcal CGI is working well, But I wonder if mORMOT is capable of that. (I know that mORMot RemoteDB is working well, But IT IS NOT CAPABLE to DO WORKS AFTER SAVING DATA)
 
« Last Edit: October 30, 2025, 09:20:24 am by BSaidus »
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

Thaddy

  • Hero Member
  • *****
  • Posts: 19158
  • Glad to be alive.
Re: mORMot1 (2) Acting like CGI
« Reply #1 on: October 30, 2025, 10:02:44 am »
Any command line program using write/writeln for output can run as a cgi, so mORMot1 and 2 too.
Running it as cgi is somewhat out of the box, but of course you probably need some formatting work and input field streams.
A cgi is basically nothing more than a command line program:
Code: Pascal  [Select][+][-]
  1. begin
  2.   writeln('Hello, world');
  3. end.
is a cgi if you put it - compiled - in the cgi directory and change the extension to cgi.
You just need to pay some attention if you need user input.
« Last Edit: October 30, 2025, 10:08:15 am by Thaddy »
objects are fine constructs. You can even initialize them with constructors.

BSaidus

  • Hero Member
  • *****
  • Posts: 665
  • lazarus 1.8.4 Win8.1 / cross FreeBSD
Re: mORMot1 (2) Acting like CGI
« Reply #2 on: October 30, 2025, 10:09:21 am »
Any command line program using write/writeln for output can run as a cgi, so mORMot1 and 2 too.
Running it as cgi is somewhat out of the box, but of course you probably need some formatting work and input field streams.
A cgi is basically nothing more than a command line program:
Code: Pascal  [Select][+][-]
  1. begin
  2.   writeln('Hello, world');
  3. end.
is a cgi if you put it in the cgi directory and change the extension to cgi.
You just need to pay some attention if you need user input.

I understand that, but what if there is a possibility for mORMOt RemoteDB to fire events after receiving, sending data for exemple?
lazarus 1.8.4 Win8.1 / cross FreeBSD
dhukmucmur vernadh!

Thaddy

  • Hero Member
  • *****
  • Posts: 19158
  • Glad to be alive.
Re: mORMot1 (2) Acting like CGI
« Reply #3 on: October 30, 2025, 10:15:53 am »
Yes, because that has nothing to do with the Input/Output logic. It is as in every other program provided your cgi has a messageloop for the events. (no events without messageloop)
objects are fine constructs. You can even initialize them with constructors.

 

TinyPortal © 2005-2018