[fpc-devel] First pas2js public release

Michael Van Canneyt michael at freepascal.org
Wed Dec 20 11:36:37 CET 2017



On Tue, 19 Dec 2017, Lukasz Sokol wrote:

> On 18/12/17 08:59, Michael Schnell wrote:
>> Great !
>> 
>> Thanks a lot to all who  enabled this fantastic enhancement to the
>> fpc system !
>> 
>> I have been dreaming of being able to "simply run" Lazarus projects
>> (and legacy Delphi-) ) in a server and have the GUI displayed in a
>> browser.
>> 
>> This seems to get in reach right now :) :)  :) .  (OK, splitting the
>> project in a server and a browser part and communication between the
>> parts will not be automatically done in very near future, but who
>> knows ....)
>> 
>
> If I Understand This Correctly,
>
> pas2js treated program would run in a browser, client side only ?
> And does not care what the server is, because it does not run on server ?

Yes.

(Note that you could write a Node.js program using pas2js, so you would have
a pas2js program on the server, and one on the browser)

>
> For 'server' side you then write 'as usual' e.g. cgi or other way available
> (server-native binary)

Yes.

>
> (Nothing stops really the server-side-native binary (e.g. written in Pascal)
> from sending a pas2js transpiled program to the browser as a part of a 'html page'/script,

You could do so.

But I don't think you should.

> but the line of separation is pretty clear here : this is like doing Graeme's favorite GUI to non-gui portion separation ';) 
> but still YOU are doing the separation manually - you need to write BOTH portions separately)

Yes. HTTP is client server.

You program both separately, this is natural.


> For communication between the browser end and the server end, there are ways covered 
> (AJAX ?) not much different than the usual (js in browser <-> java/php/perl/python/server side js in server)
> LAMP stack does.

Yes. Normal Ajax works, see the demos.

But we went a step further. TDataset and REST works out of the box. See also the demos.

Michael.



More information about the fpc-devel mailing list