-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c87a64d
commit d31589d
Showing
5 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"hash": "d41d8cd98f00b204e9800998ecf8427e", | ||
"updated": "2020-11-04T21:25:53.8317735-03:00", | ||
"installedModules": { | ||
"github.com/hashload/horse": { | ||
"name": "horse", | ||
"version": "v2.0.3", | ||
"hash": "fb7144725ff788c49af1307f97f23b5a", | ||
"artifacts": {}, | ||
"failed": false, | ||
"changed": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "lazarus", | ||
"description": "", | ||
"version": "1.0.0", | ||
"homepage": "", | ||
"mainsrc": "./", | ||
"projects": [], | ||
"dependencies": { | ||
"github.com/hashload/horse": "^v2.0.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CONFIG> | ||
<ProjectOptions> | ||
<Version Value="11"/> | ||
<PathDelim Value="\"/> | ||
<General> | ||
<Flags> | ||
<MainUnitHasCreateFormStatements Value="False"/> | ||
<MainUnitHasScaledStatement Value="False"/> | ||
</Flags> | ||
<SessionStorage Value="InProjectDir"/> | ||
<MainUnit Value="0"/> | ||
<Title Value="My Application"/> | ||
<UseAppBundle Value="False"/> | ||
<ResourceType Value="res"/> | ||
</General> | ||
<BuildModes Count="1"> | ||
<Item1 Name="Default" Default="True"/> | ||
</BuildModes> | ||
<PublishOptions> | ||
<Version Value="2"/> | ||
<UseFileFilters Value="True"/> | ||
</PublishOptions> | ||
<RunParams> | ||
<FormatVersion Value="2"/> | ||
<Modes Count="0"/> | ||
</RunParams> | ||
<Units Count="1"> | ||
<Unit0> | ||
<Filename Value="samples.lpr"/> | ||
<IsPartOfProject Value="True"/> | ||
</Unit0> | ||
</Units> | ||
</ProjectOptions> | ||
<CompilerOptions> | ||
<Version Value="11"/> | ||
<PathDelim Value="\"/> | ||
<Target> | ||
<Filename Value="samples"/> | ||
</Target> | ||
<SearchPaths> | ||
<IncludeFiles Value="$(ProjOutDir)"/> | ||
<OtherUnitFiles Value="modules\horse\src;..\..\src"/> | ||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> | ||
</SearchPaths> | ||
</CompilerOptions> | ||
<Debugging> | ||
<Exceptions Count="4"> | ||
<Item1> | ||
<Name Value="EAbort"/> | ||
</Item1> | ||
<Item2> | ||
<Name Value="ECodetoolError"/> | ||
</Item2> | ||
<Item3> | ||
<Name Value="EFOpenError"/> | ||
</Item3> | ||
<Item4> | ||
<Name Value="EResNotFound"/> | ||
</Item4> | ||
</Exceptions> | ||
</Debugging> | ||
</CONFIG> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
program samples; | ||
|
||
{$MODE DELPHI}{$H+} | ||
|
||
uses | ||
{$IFDEF UNIX}{$IFDEF UseCThreads} | ||
cthreads, | ||
{$ENDIF}{$ENDIF} | ||
Horse, Horse.Jhonson, fpjson, SysUtils; | ||
|
||
procedure PostPing(Req: THorseRequest; Res: THorseResponse; Next: TNextProc); | ||
var | ||
LBody: TJSONObject; | ||
begin | ||
LBody := Req.Body<TJSONObject>; | ||
Res.Send<TJSONObject>(LBody); | ||
end; | ||
|
||
procedure OnListen(Horse: THorse); | ||
begin | ||
Writeln(Format('Server is runing on %s:%d', [Horse.Host, Horse.Port])); | ||
end; | ||
|
||
begin | ||
THorse.Use(Jhonson); | ||
|
||
THorse.Post('/ping', PostPing); | ||
|
||
THorse.Listen(9000, OnListen); | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters