From f6db9716e569428bf8c34b306160d0f7d415fc2a Mon Sep 17 00:00:00 2001 From: Vinicius Sanchez Date: Mon, 27 Dec 2021 21:34:06 -0300 Subject: [PATCH] Update README.md --- README.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c22cbf4..b7b6817 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This middleware is compatible with projects developed in: - [X] Delphi - [X] Lazarus -## ⚡️ Quickstart +## ⚡️ Quickstart Delphi ```delphi uses Horse, @@ -46,5 +46,37 @@ begin end; ``` +## ⚡️ Quickstart Lazarus +```delphi +{$MODE DELPHI}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Horse, + Horse.OctetStream, // It's necessary to use the unit + SysUtils, + Classes; + +procedure GetStream(Req: THorseRequest; Res: THorseResponse; Next: TNextProc); +var + LStream: TFileStream; +begin + // Now you can send your stream: + LStream := TFileStream.Create(ExtractFilePath(ParamStr(0)) + 'horse.pdf', fmOpenRead); + Res.Send(LStream); +end; + +begin + // It's necessary to add the middleware in the Horse: + THorse.Use(OctetStream); + + THorse.Get('/stream', GetStream); + + THorse.Listen(9000); +end. +``` + ## ⚠️ License `horse-octet-stream` is free and open-source middleware licensed under the [MIT License](https://github.com/HashLoad/horse-octet-stream/blob/master/LICENSE).