Forum > Packages and Libraries
PascalRAL the fastest, most feature-rich http component suite for Pascal
(1/1)
Mobius1:
hi everyone!
I wanna share with you the best http framework for Pascal! (Delphi, Lazarus and others)
https://github.com/OpenSourceCommunityBrasil/PascalRAL
There's also a dedicated sample repository with lots of examples:
https://github.com/OpenSourceCommunityBrasil/PascalRAL-Samples
This is a quick simple example of a working webserver:
--- 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";}};} ---program RALWebExample; uses Classes, SysUtils, System.IOUtils, // Choose here the engine of the server RALSynopseServer, //RALIndyServer, //RALSaguiServer, RALServer, RALWebModule, // routing unit Web.Routes in 'src/web.routes.pas'; var FServer: TRALServer; FWebModule: TRALWebModule;begin // Change the engine of the server here: FServer := TRALSynopseServer.Create(nil); //FServer := TRALIndyServer.Create(nil); //FServer := TRALSaguiServer.Create(nil); FWebModule := TRALWebModule.Create(nil); try FWebModule.Server := FServer; { Defining the root path where the webfiles should be stored. We use TPath.Combine here for easy compatibility between Windows and Linux servers, since Windows uses '/' for folders and Linux uses '\'. It's easy to mix those so TPath solves that } FWebModule.DocumentRoot := TPath.Combine(ExtractFileDir(ParamStr(0)), 'web'); // adding routes to the server from unit Web.Routes: RegisterWebRoutes(FWebModule); FServer.Port := 8000; // 8000 is the default port if none is assigned. FServer.Start; WriteLn('RALServer running on Port ' + FServer.Port.ToString); WriteLn('Press any key to finish'); ReadLn; finally FServer.Stop; FreeAndNil(FWebModule); FreeAndNil(FServer); end;end.
We aimed for speed, simplicity and flexibility in this project as well as being independent of any specific http component, like indy. We also support RAD and DBWare in the project with plans on improving the speed in future updates.
The framework has been in development for 3 years but only last year that we managed to make it stable and resilient enough to be publicly available. It's currently in release candidate and we'll launch the first stable version before adding even more features.
Since practically every HTTP framework out there is depedant on indy and are slow as a slime because indy is slow, we aim to kill that handicap and use the fastest possible data engines available to make Pascal API servers as competent as other languages' server frameworks.
We also added support to FPC-Unleashed, currently available under the "dev" branch.
We look forward to hear your feedback, any issues can be reported in the repository and we welcome any PRs with improvements to the code.
I'll answer any questions or doubts you might have too, just lemme know.
440bx:
Looks like a solid step in the right direction. :)
Thank you for all the hard work and for sharing it.
Mobius1:
PascalRAL has launched its first stable release version!
Thank you all for contributing with us this far, we expect more insights in the future to keep this framework the best possible one for Pascal, and all its IDEs like Delphi, Lazarus, Oxygene, PascalABC and future ones.
New versions are scheduled to be release once the new features are implemented, we intend to implement a new optimization refactoring in the next version of the framework, along with a few changes in the core units to try to reduce complexity making it 60% faster on best case scenario hopefully.
Keep your feedback comming, we welcome them all!
LemonParty:
How do you acheived more speed?
What technic was used?
Mobius1:
Not using Indy only like every other framework out there was one thing, fine tuning the engine internally was another thing but there are some slowness still that we gonna solve in the next updates to make it even better.
Navigation
[0] Message Index