Can Lazarus apps be set up on servers and executed through Apache or other web servers?
Sent from my iPhone

Mailing lists / lazarus / 2015-08
16 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Can Lazarus apps be set up on servers and executed through Apache or other web servers?
Sent from my iPhone
Larry Dalton wroteCan Lazarus apps be set up on servers and executed through Apache or other web servers?
fpweb based apps, yes. Gui apps not. I have a whole ecosystem of such apps running.
Michael;I have a very large application with at least 20 forms. What would be the first step in rewriting it as a web app?
Sent from my iPhone
Larry Dalton wroteI have a very large application with at least 20 forms. What would be the first step in rewriting it as a web app?
- Completely split all GUI logic from business logic.
- Create an API that encapsulates the business logic.
- In essence you'll then have to rewrite all GUI handling. So, depending on the application:
Decide whether you want to write a RIA or a simple series of webpages ?
Michael.
What libraries and tolls do you use for implementing API, DB and webpages?
Regards,
Ara
To whom are you asking this question ?
Without any context or quoted text whatsoever, this is hard to determine ?
Michael.
Easy,You!
You know the way and me and Larry are asking from you. Beside you should used to it until now that I always have a question from you ;)
But I try to specific whom the next time.
Regards,
Ara
Just quote part of the original mail, that is usually sufficient to determine context.
To answer your question:
- I use Firebird as a database, which I access using SQLDB. A
- Data is exposed to webpages using a simple REST layer. There are even Lazarus GUI programs that act as a client to the REST layer.
- There is also an RPC mechanism.
For this I use ExtJS' ExtDirect protocol, which is a specific version of json-rpc. (this is available in FPC)
- Client (browser) is programmed independently in ExtJS and AngularJS by a team of webdesigners. (but you could use fpweb and templates for this as well)
It's all very simple, really. In architecture, it resembles the google-apis recently committed in fpc. Also, for example tiOPF provides a lot of the building blocks you may need. Transforming tiOPF objects to JSON for example is really easy and can be done using the rttiutils unit. I even ported that unit to Delphi using the superobject library (by henri gourvest).
I've used the same techniques in many different projects now for several years, and I consider it a succesful recipe.
Michael.
Very good.So what library do you use for making JSON API? tiPOF or fpweb?
Regards,
Ara
Aradeonas wroteVery good.So what library do you use for making JSON API? tiPOF or fpweb?
Both.
I read business objects with tiOPF using the tiSQLdb visitors, and stream using fpweb.
I have almost finishing writing a unit - which I will commit to FPC very soon - that takes a *sample* json file and creates an object from it. The object does not depend on anything, and contains code to stream it from/to json in the format that was used to create it.
It should make consuming/producing REST services (using JSON, obviously) very easy. I will integrate it in the jsonviewer application distributed with Lazarus.
Michael.
Michael-
Thanks for doing this work. I am also very interested in it!
---- On Sun, 30 Aug 2015 16:21:18 -0400 Michael Van Canneyt <> wrote ----
I have almost finishing writing a unit - which I will commit to FPC very soon - that takes a *sample* json file and creates an object from it. The object does not depend on anything, and contains code to stream it from/to json in the format that was used to create it.
It should make consuming/producing REST services (using JSON, obviously) very easy. I will integrate it in the jsonviewer application distributed with Lazarus.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150830/3f3517cb/attachment.html>
Stay tuned for more ;)
Michael.
Can Lazarus apps be set up on servers and executed through Apache or other web servers?…
Larry Dalton wroteCan Lazarus apps be set up on servers and executed through Apache or other web servers?
Just for the record: In Linux anything that can be "started" and can generate a text output can be used as a CGI. Including a bash script, a file for interpreters such as java, perl, LUA, php,..., and of course an executable for the appropriate arch.
-Michael
I have a very large application with at least 20 forms. What would be the first step in…
Larry Dalton wroteI have a very large application with at least 20 forms. What would be the first step in rewriting it as a web app?
In addition to Larries suggestion you (if necessary) should decide which method to use to do "remote events", i.e. having your CGI output something to the browser without the user having requested this explicitly right before.
Here you need the CGI) to stay active without a pending request (e.g. have it be an FCGI) and you need some java script in the browser that polls for events, as HTTP does not (normally) allow for "pushing" an event.
There are several "standard" frameworks that build a GUI (including Event handling) in the browser, but AFAIK none of them provides an interface to Lazarus, nor does Lazarus support any of those. (There once had been "EXTPASCAL", but this project seems to have died.)
-Michael
Michael Schnell wroteIn addition to Larries suggestion
Sorry, of course I meant Michael vC's suggestions.
-Michael
Both. I read business objects with tiOPF using the tiSQLdb visitors, and stream using…
Michael Van Canneyt wroteI have almost finishing writing a unit
...
GREAT !!
-Michael