Forum > Networking and Web Programming

New to internet programming frustrations

<< < (2/4) > >>

nummer8:
Marcus Fernstrom wrote a few articles on freepascal and internet on medium

https://medium.com/@marcusfernstrm

Serving static webpages
https://medium.com/@marcusfernstrm/serve-static-webpages-with-freepascal-c0d9c9dee352


Creating Rest API's
https://medium.com/@marcusfernstrm/create-rest-apis-with-freepascal-441e4aa447b7

and several related issues.

Thaddy:

--- Quote from: dgrhoads on March 30, 2024, 06:14:10 pm ---Thanks for the suggestions.
I successfully loaded the fpweb package.
--- End quote ---
Which is strange because it is already in the fpc distribution. Such things can only cause harm.
and fcl-web is packed full of examples. fcl-web used to be called fpweb so that is definitely old.

egsuh:
Hello,

The Tutorial is outdated --- recent Lazarus is slightly different.
You may add Webmodule at the creation of New (Http server) application, as in the attached image. Probably the red-circled part is not in the tutorial.

But as you have already created the project (without webmodule), you can add it. Go to main menu File > New > WebModule, and press OK. Then you may resume at #5 of the Tutorial.



--- Quote ---4. Whatever you choose, pick "OK" and you'll be presented in the default one module fpWeb app.

5. Focus the module and move to Object Inspector. Feel free to rename the module if you wish.
--- End quote ---

Don't get frustrated. Here are some people to advise you.

Leledumbo:

--- Quote from: egsuh on April 02, 2024, 08:38:59 am ---The Tutorial is outdated --- recent Lazarus is slightly different.

--- End quote ---
Part is me to blame as the original author of the article, I assume people will contribute and update accordingly. Turns out my assumption is wrong.

--- Quote from: dgrhoads on March 30, 2024, 06:14:10 pm ---Is it possible to use fpweb with a straight Application rather than the HTTP Server Application or the CGI Application?  If so, is there a tutorial on how to do that?

--- End quote ---
You can even use it without any IDE, just a text editor. As written in the New Mechanism part of my tutorial:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses  fphttpapp, httpdefs, httproute; procedure DoHello(ARequest:TRequest; AResponse : TResponse);begin  AResponse.Content:='<html><body><h1>Hello,World!</h1></body></html>'end; begin  HTTPRouter.RegisterRoute('*', @DoHello);  Application.Port := 9000;  Application.Initialize;  Application.Run;end. is all you need to get a working "Hello, World" example. I should probably write a new tutorial ignoring everything that uses the form designer or even the IDE wizard.

sunjob:

--- Quote from: Leledumbo on April 02, 2024, 12:36:20 pm ---... write a new ...

--- End quote ---

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---port <= 1023 -->> www-server start on port: 1023Exception at 0000000000497D98: ESocketError:Binding of socket failed: 1023. web-server is default 80-port  :o

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version