Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

Lazarus applications as webpaged

16 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to Larry Dalton
Larry Dalton wrote
Can 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;

Reply by email

Larry Dalton
to Michael Van Canneyt

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

Show quoted text 17 lines
On Aug 30, 2015, at 08:50, Michael Van Canneyt wrote: > On Sun, 30 Aug 2015, Larry Dalton wrote: > > Can 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; -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Michael Van Canneyt
to Larry Dalton
Larry Dalton wrote
I 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.

Reply by email

Michael Van Canneyt
to Aradeonas
Aradeonas wrote 5 lines
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.

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.

Reply by email

Michael Van Canneyt
to Aradeonas
Aradeonas wrote
Very 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.

Reply by email

DougC
to Michael Van Canneyt

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>

Reply by email

Michael Van Canneyt
to DougC

Stay tuned for more ;)

Michael.

DougC wrote 19 lines
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 &lt;&gt; 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.

Reply by email

Michael Schnell
to Larry Dalton: Can Lazarus apps be set up on servers and executed through Apache or other web servers?…
Larry Dalton wrote
Can 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

Reply by email

Michael Schnell
to Larry Dalton: I have a very large application with at least 20 forms. What would be the first step in…
Larry Dalton wrote
I 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

Reply by email