From 3a0168e1ece4d257ac3defd58522add46addb562 Mon Sep 17 00:00:00 2001 From: Vinicius Sanchez Date: Mon, 27 Dec 2021 21:41:53 -0300 Subject: [PATCH] Update README.md --- README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3358713..654288b 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ This middleware is compatible with projects developed in: - [X] Delphi - [X] Lazarus -## ⚡️ Quickstart +## ⚡️ Quickstart Delphi ```delphi uses Horse, @@ -50,5 +50,36 @@ begin end; ``` +## ⚡️ Quickstart Lazarus +```delphi +{$MODE DELPHI}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Horse, + Horse.Jhonson, // It's necessary to use the unit + Horse.HandleException, // It's necessary to use the unit + SysUtils; + +procedure GetPing(Req: THorseRequest; Res: THorseResponse; Next: TNextProc); +begin + // Manage your exceptions: + raise EHorseException.Create('My Error'); +end; + +begin + // It's necessary to add the middlewares in the Horse: + THorse + .Use(Jhonson) // It has to be before the exceptions middleware + .Use(HandleException); + + THorse.Get('/ping', GetPing); + + THorse.Listen(9000); +end. +``` + ## ⚠️ License `handle-exception` is free and open-source middleware licensed under the [MIT License](https://github.com/HashLoad/handle-exception/blob/master/LICENSE).