Brook is a cross-platform microframework which helps to develop web Pascal applications built by Delphi or Lazarus IDE and Free Pascal. Its core has been developed using the Sagui library, that’s why it is so fast, compact and useful to run on embedded systems.
- Three threading modes:
- Event-driven - single-thread + polling.
- Threaded - one thread per request.
- Polling - pre-allocated threads.
- Isolated request - request processed outside main thread.
- Fast path routing that supports:
- HTTP compression:
- HTTP cookies:
- Providing classes which handles server side cookies.
- HTTPS support:
- Data encryption through GnuTLS library.
- Dual stack:
- IPv4 and IPv6 on top of a single socket.
- Basic authentication:
- For standard login using username and password.
- Static body and payload.
- Content streaming for real-time applications.
- Small and large files transferring.
- Mathematical expression evaluator:
- Arithmetic, bitwise and logical operators.
- Variables allocation at build and/or run time.
- Macro support to define functions at run time.
- Extendable with custom functions.
- Error handling with error kind and position.
- Media types:
- Resolving media types (MIME) in any supported platform.
- Allowing to generate logs in console or files.
- String buffer:
- For fast operations involving strings.
- String map:
- Hashed lists for key-value mapping.
- And more:
- Discover more features by playing with our examples.
The example below shows a minimal
hello world HTTP server:
type THTTPServer = class(TBrookHTTPServer) protected procedure DoRequest(ASender: TObject; ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse); override; end; procedure THTTPServer.DoRequest(ASender: TObject; ARequest: TBrookHTTPRequest; AResponse: TBrookHTTPResponse); begin AResponse.Send('Hello world', 'text/plain', 200); end; begin with THTTPServer.Create(nil) do try Port := 8080; if not Active then Exit; WriteLn('Server running at http://localhost:', Port); Open; ReadLn; finally Free; end; end.
There are other examples available in the
Successfully tested on:
- Delphi XE family (Rio)
- Lazarus / Free Pascal (Lazarus 2.0+ / FPC 3.2+)
Starting from the version 1.0.0, Brook follows the SemVer rules regarding API changes with backwards compatibility across major releases.
Brook framework is released under GNU Lesser General Public License v2.1. Check the LICENSE file for more details.
The documentation has been written in PasDoc and is available in HTML format at brookframework-docs/index.html.
All stable releases are available for download at the releases page.
To download the very latest source from the Git server, do this:
git clone https://github.com/risoflora/brookframework.git
It will create a directory named
brookframework filled with the source code.
Brook framework is totally open source and would not be possible without our contributors. If you want to submit contributions, please fork the project on GitHub and send a pull request. You retain the copyright on your contributions. If you have questions, open a new issue at the issues page. For donations to support this project, please click the button below.
If you are Brazilian and want to donate using more options in BRL, please make an identified Nubank deposit or use this PayPal link.
See the name of all donors in DONORS file. :green_heart:
This project is completely self-explanatory, but, if you need a consulting service to integrate it on your project, contact us.