Skip to content

Commit 706ae9a

Browse files
Update README.md #11
1 parent aa6c992 commit 706ae9a

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

README.md

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,54 @@
11
# handle-exception
2-
Middleware for handle exception in HORSE
2+
<b>Handle-exception</b> is a official middleware for handling exceptions in APIs developed with the <a href="https://github.com/HashLoad/horse">Horse</a> framework.
3+
<br>We created a channel on Telegram for questions and support:<br><br>
4+
<a href="https://t.me/hashload">
5+
<img src="https://img.shields.io/badge/telegram-join%20channel-7289DA?style=flat-square">
6+
</a>
37

4-
Sample Horse Server
8+
## ⭕ Prerequisites
9+
[**jhonson**](https://github.com/HashLoad/jhonson) - Jhonson is a official middleware for working with JSON in APIs developed with the Horse framework.
10+
11+
*Obs: If you use Boss (dependency manager for Delphi), the jhonson will be installed automatically when installing handle-exception.*
12+
13+
## ⚙️ Installation
14+
Installation is done using the [`boss install`](https://github.com/HashLoad/boss) command:
15+
``` sh
16+
$ boss install handle-exception
17+
```
18+
If you choose to install manually, simply add the following folders to your project, in *Project > Options > Resource Compiler > Directories and Conditionals > Include file search path*
19+
```
20+
../handle-exception/src
21+
```
22+
23+
## ✔️ Compatibility
24+
This middleware is compatible with projects developed in:
25+
- [X] Delphi
26+
- [X] Lazarus
27+
28+
## ⚡️ Quickstart
529
```delphi
6-
uses Horse, Horse.Jhonson, Horse.HandleException, System.SysUtils;
30+
uses
31+
Horse,
32+
Horse.Jhonson, // It's necessary to use the unit
33+
Horse.HandleException, // It's necessary to use the unit
34+
System.JSON;
735
836
begin
37+
// It's necessary to add the middlewares in the Horse:
938
THorse
10-
.Use(Jhonson())
39+
.Use(Jhonson) // It has to be before the exceptions middleware
1140
.Use(HandleException);
1241
13-
THorse.Get('/ping',
42+
THorse.Post('/ping',
1443
procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
1544
begin
45+
// Manage your exceptions:
1646
raise EHorseException.Create('My Error!');
1747
end);
1848
1949
THorse.Listen(9000);
20-
end.
50+
end;
2151
```
52+
53+
## ⚠️ License
54+
`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)