[fpc-pascal] Bls: Writing fpWeb app without Lazarus

Michael Van Canneyt michael at freepascal.org
Wed Jun 8 10:59:53 CEST 2016



On Wed, 8 Jun 2016, Mr Bee wrote:

> Pada Selasa, 7 Juni 2016 15:23, Michael Van Canneyt <michael at freepascal.org> menulis:
>
>
>
>> What is the URL you used to access your app ?
> http://beeography.koding.io/hello.cgi (/mod) (/act [/act1 | act/act2])
>
> And here's the source code: http://pastebin.com/N7EQz4Lk Feel free to correct any mistakes in my code. Thank you.
>> What is the output in the browser ?
> Just a "hello world" message.
>
>> Then, never create an instance of a webmodule manually, always let the
> framework create instances.
> Yes, the problem has been solved with a help from Mario's ebook (https://bitbucket.org/leledumbo/books/downloads/fpwebtutorial-chromeprint.pdf). Mario is also known as @leledumbo at Lazarus' forum.
>> Also, a statement as
>> HelloModule := THelloModule.Create(nil);
>> is wrong, since it will attempt to stream the module. If you do want to
>> create modules manually, do
>> HelloModule := THelloModule.CreateNew(nil,0);
>
> Yes, I should have figured it out earlier, but it's been a long time since the last time I used TDataModule, so there are many things that I forgot about VCL. In fact, that's the main source of my problem. Once I used the CreateNew constructor, everything works as expected. Though I still have many things to learn to understand how the fpWeb works. :)
>
>> No, this is not possible.
>> It was explicitly designed to use classes in a RAD environment.
>> It is perfectly possible to drop the RAD part and use the classes as-is, but
>> it is not possible not to use the classes.
> I don't mind the clasess, but I do mind the RAD part. A web app development should be able to be done without the RAD part because in some cases we don't always have the access to use the RAD.

I develop using fpweb all the time, without RAD, so I know this works :-)

>
>> There are multiple examples in the FPC source tree; 
>> Why don't you use those as a starting point ?
> I did. But all the examples I found are using Lazarus aka RAD. Hence this email.
> fpWeb —and all the gems of FCL— do really need proper and complete documentations. 
> It's hard —especially for Pascal newbies— to learn FCL from the source code alone. 
> Documentation is the main and first obstacle for everyone who like to use FCL to its potential. I wish I could help.

There are over 1000 units. There is only 1 documenter...

On
http://www.freepascal.org/~michael/articles/
you can find some articles that explain the workings of fcl-web. 
See web1, web2.

Michael.


More information about the fpc-pascal mailing list