Skip to content

joestarzxh/brookframework

 
 

Repository files navigation

License: LGPL v2.1 GitHub releases

Overview

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.

Features

  • Three threading modes:
    • Event-driven - single thread.
    • Threaded - one thread per request.
    • Polling - thread pool.
  • Fast path routing that supports:
    • Regular expression with JIT optimization.
    • Binary search for path entry-points.
  • HTTP compression:
    • Deflate - for static strings and streaming.
    • Gzip - for file 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 user name and password.
  • Download/upload:
    • Static body and payload.
    • Content streaming for real-time applications.
    • Small and large files transferring.
  • Media types:
    • Resolving media types (MIME) in any supported platform.
  • 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.

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 Examples/ directory.

OSes/compilers

Successfully tested on:

  • Windows
  • Linux
  • Raspbian/Android

compiled using:

  • Delphi XE family (Rio)
  • Lazarus / Free Pascal (Lazarus 2.0+ / FPC 3.0+)

Versioning

Starting from the version 1.0.0, Brook follows the SemVer rules regarding API changes with backwards compatibility across major releases.

Licensing

Brook framework is released under GNU Lesser General Public License v2.1. Check the LICENSE file for more details.

Documentation

The documentation has been written in PasDoc and is available in HTML format at brookframework-docs/index.html.

Downloading

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.

Contributing

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.

Support this project

Support

This project is completely self-explanatory, but, if you need a consulting service to integrate it on your project, contact us.

About

Microframework which helps to develop web Pascal applications.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Pascal 97.5%
  • CSS 1.3%
  • Other 1.2%