Skip to content

Commit

Permalink
Lazarus samples #9
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciussanchez committed Oct 5, 2021
1 parent a812030 commit aa6c992
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 170 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Uncomment these types if you want even more clean repository. But be careful.
# It can make harm to an existing project source. Read explanations below.
#

# Resource files are binaries containing manifest, project icon and version info.
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
#*.res
#
*.res

# Type library file (binary). In old Delphi versions it should be stored.
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
#*.tlb
Expand Down
Binary file removed HandleException.res
Binary file not shown.
10 changes: 5 additions & 5 deletions boss-lock.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"hash": "830981b993a8554a72d15f4378c1a4cc",
"updated": "2020-12-08T14:56:32.3089177-03:00",
"updated": "2021-10-05T08:22:22.2575717-03:00",
"installedModules": {
"github.com/hashload/horse": {
"name": "horse",
"version": "v2.0.6",
"hash": "cca1769dfab681cfd26ae8499f9045e1",
"version": "v2.0.14",
"hash": "38c6bebdc7b9712d6e5856d299289a26",
"artifacts": {},
"failed": false,
"changed": false
},
"github.com/hashload/jhonson": {
"name": "jhonson",
"version": "1.0.7",
"hash": "e0a2cfad431f565769ebe2815299924b",
"version": "1.1.2",
"hash": "85d9b3c97b5144448440d7d26bdd16de",
"artifacts": {},
"failed": false,
"changed": false
Expand Down
4 changes: 2 additions & 2 deletions boss.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"mainsrc": "src/",
"projects": [],
"dependencies": {
"github.com/hashload/horse": "^2.0.0",
"github.com/hashload/jhonson": "^1.0.7"
"github.com/hashload/horse": "^2.0.14",
"github.com/hashload/jhonson": "^1.1.2"
}
}
22 changes: 0 additions & 22 deletions samples/boss-lock.json

This file was deleted.

12 changes: 0 additions & 12 deletions samples/boss.json

This file was deleted.

File renamed without changes.
127 changes: 1 addition & 126 deletions samples/samples.dproj → samples/delphi/samples.dproj

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions samples/lazarus/Console.lpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Console"/>
<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="Console.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="Console"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<OtherUnitFiles Value="..\..\src;..\..\modules\horse\src;..\..\modules\jhonson\src"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Other>
<CustomOptions Value="-dUseCThreads"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>
32 changes: 32 additions & 0 deletions samples/lazarus/Console.lpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
program Console;

{$MODE DELPHI}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Horse,
Horse.Jhonson,
Horse.HandleException,
SysUtils;

procedure GetPing(Req: THorseRequest; Res: THorseResponse; Next: TNextProc);
begin
raise EHorseException.Create('My Error');
end;

procedure OnListen(Horse: THorse);
begin
Writeln(Format('Server is runing on %s:%d', [Horse.Host, Horse.Port]));
end;

begin
THorse
.Use(Jhonson)
.Use(HandleException);

THorse.Get('/ping', GetPing);

THorse.Listen(9000, OnListen);
end.
Binary file removed samples/samples.res
Binary file not shown.

0 comments on commit aa6c992

Please sign in to comment.