Skip to content

Commit 882960b

Browse files
Added samples and code improvements
1 parent fc5280b commit 882960b

5 files changed

Lines changed: 909 additions & 2 deletions

File tree

samples/Samples.dpr

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
program Samples;
2+
3+
{$APPTYPE CONSOLE}
4+
5+
{$R *.res}
6+
7+
uses
8+
Horse, Horse.BasicAuthentication, System.SysUtils;
9+
10+
var
11+
App: THorse;
12+
13+
begin
14+
App := THorse.Create(9000);
15+
16+
App.Use(HorseBasicAuthentication(
17+
function(const AUsername, APassword: string): Boolean
18+
begin
19+
Result := AUsername.Equals('user') and APassword.Equals('password');
20+
end));
21+
22+
App.Get('ping',
23+
procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
24+
begin
25+
Res.Send('pong');
26+
end);
27+
28+
App.Start;
29+
end.

0 commit comments

Comments
 (0)