Skip to content

Commit 3a0168e

Browse files
Update README.md
1 parent 1ab5d3b commit 3a0168e

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

README.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This middleware is compatible with projects developed in:
2525
- [X] Delphi
2626
- [X] Lazarus
2727

28-
## ⚡️ Quickstart
28+
## ⚡️ Quickstart Delphi
2929
```delphi
3030
uses
3131
Horse,
@@ -50,5 +50,36 @@ begin
5050
end;
5151
```
5252

53+
## ⚡️ Quickstart Lazarus
54+
```delphi
55+
{$MODE DELPHI}{$H+}
56+
57+
uses
58+
{$IFDEF UNIX}{$IFDEF UseCThreads}
59+
cthreads,
60+
{$ENDIF}{$ENDIF}
61+
Horse,
62+
Horse.Jhonson, // It's necessary to use the unit
63+
Horse.HandleException, // It's necessary to use the unit
64+
SysUtils;
65+
66+
procedure GetPing(Req: THorseRequest; Res: THorseResponse; Next: TNextProc);
67+
begin
68+
// Manage your exceptions:
69+
raise EHorseException.Create('My Error');
70+
end;
71+
72+
begin
73+
// It's necessary to add the middlewares in the Horse:
74+
THorse
75+
.Use(Jhonson) // It has to be before the exceptions middleware
76+
.Use(HandleException);
77+
78+
THorse.Get('/ping', GetPing);
79+
80+
THorse.Listen(9000);
81+
end.
82+
```
83+
5384
## ⚠️ License
5485
`handle-exception` is free and open-source middleware licensed under the [MIT License](https://github.com/HashLoad/handle-exception/blob/master/LICENSE).

0 commit comments

Comments
 (0)