Skip to content

Commit 3180ae9

Browse files
Samples Lazarus #5
1 parent 600d6a5 commit 3180ae9

File tree

9 files changed

+106
-32
lines changed

9 files changed

+106
-32
lines changed

boss-lock.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"hash": "d41d8cd98f00b204e9800998ecf8427e",
3-
"updated": "2019-07-15T22:22:24.4542686-03:00",
2+
"hash": "8a53e9cf872feaac975a8fad2c6a5af0",
3+
"updated": "2021-10-04T08:54:27.0678585-03:00",
44
"installedModules": {
55
"github.com/hashload/horse": {
66
"name": "horse",
7-
"version": "1.7.8",
8-
"hash": "7f82adf0188b2f66e80e7a3c603558c9",
7+
"version": "v2.0.14",
8+
"hash": "38c6bebdc7b9712d6e5856d299289a26",
99
"artifacts": {},
1010
"failed": false,
1111
"changed": false

boss.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
"mainsrc": "/src",
77
"projects": [],
88
"dependencies": {
9-
"github.com/hashload/horse": "^v2.0.0"
9+
"github.com/hashload/horse": "^v2.0.14"
1010
}
1111
}

horse_basic_auth.dproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
7373
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
7474
<SanitizedProjectName>horse_basic_auth</SanitizedProjectName>
75-
<DCC_UnitSearchPath>modules\.dcp;modules\.dcu;modules;modules\horse\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
75+
<DCC_UnitSearchPath>$(DCC_UnitSearchPath);modules\.dcp;modules\.dcu;modules;modules\horse\src</DCC_UnitSearchPath>
7676
<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
7777
</PropertyGroup>
7878
<PropertyGroup Condition="'$(Base_Android)'!=''">

samples/boss-lock.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

samples/boss.json

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
<DCC_K>false</DCC_K>
5050
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
5151
<SanitizedProjectName>Samples</SanitizedProjectName>
52-
<DCC_UnitSearchPath>modules\.dcp;modules\.dcu;$(DCC_UnitSearchPath);modules;modules\horse\src</DCC_UnitSearchPath></PropertyGroup>
52+
<DCC_UnitSearchPath>..\..\src;..\..\modules\horse\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
53+
</PropertyGroup>
5354
<PropertyGroup Condition="'$(Base_Win32)'!=''">
5455
<DCC_UsePackage>DBXSqliteDriver;IndyIPCommon;RESTComponents;bindcompdbx;DBXInterBaseDriver;vcl;IndyIPServer;vclactnband;vclFireDAC;IndySystem;tethering;svnui;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;vclimg;FireDAC;vcltouch;vcldb;bindcompfmx;svn;FireDACSqliteDriver;FireDACPgDriver;inetdb;soaprtl;DbxCommonDriver;fmx;FireDACIBDriver;fmxdae;xmlrtl;soapmidas;fmxobj;vclwinx;rtl;DbxClientDriver;CustomIPTransport;vcldsnap;dbexpress;IndyCore;vclx;bindcomp;appanalytics;dsnap;FireDACCommon;IndyIPClient;bindcompvcl;RESTBackendComponents;VCLRESTComponents;soapserver;dbxcds;VclSmp;adortl;vclie;bindengine;DBXMySQLDriver;CloudService;dsnapxml;FireDACMySQLDriver;dbrtl;IndyProtocols;inetdbxpress;FireDACCommonODBC;FireDACCommonDriver;inet;fmxase;$(DCC_UsePackage)</DCC_UsePackage>
5556
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>

samples/lazarus/Console.lpi

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<CONFIG>
3+
<ProjectOptions>
4+
<Version Value="11"/>
5+
<PathDelim Value="\"/>
6+
<General>
7+
<Flags>
8+
<MainUnitHasCreateFormStatements Value="False"/>
9+
<MainUnitHasTitleStatement Value="False"/>
10+
<MainUnitHasScaledStatement Value="False"/>
11+
</Flags>
12+
<SessionStorage Value="InProjectDir"/>
13+
<MainUnit Value="0"/>
14+
<Title Value="Console"/>
15+
<UseAppBundle Value="False"/>
16+
<ResourceType Value="res"/>
17+
</General>
18+
<BuildModes Count="1">
19+
<Item1 Name="Default" Default="True"/>
20+
</BuildModes>
21+
<PublishOptions>
22+
<Version Value="2"/>
23+
<UseFileFilters Value="True"/>
24+
</PublishOptions>
25+
<RunParams>
26+
<FormatVersion Value="2"/>
27+
<Modes Count="0"/>
28+
</RunParams>
29+
<Units Count="1">
30+
<Unit0>
31+
<Filename Value="Console.lpr"/>
32+
<IsPartOfProject Value="True"/>
33+
</Unit0>
34+
</Units>
35+
</ProjectOptions>
36+
<CompilerOptions>
37+
<Version Value="11"/>
38+
<PathDelim Value="\"/>
39+
<Target>
40+
<Filename Value="Console"/>
41+
</Target>
42+
<SearchPaths>
43+
<IncludeFiles Value="$(ProjOutDir)"/>
44+
<OtherUnitFiles Value="..\..\src;..\..\modules\horse\src"/>
45+
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
46+
</SearchPaths>
47+
<Other>
48+
<CustomOptions Value="-dUseCThreads"/>
49+
</Other>
50+
</CompilerOptions>
51+
<Debugging>
52+
<Exceptions Count="3">
53+
<Item1>
54+
<Name Value="EAbort"/>
55+
</Item1>
56+
<Item2>
57+
<Name Value="ECodetoolError"/>
58+
</Item2>
59+
<Item3>
60+
<Name Value="EFOpenError"/>
61+
</Item3>
62+
</Exceptions>
63+
</Debugging>
64+
</CONFIG>

samples/lazarus/Console.lpr

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
program Console;
2+
3+
{$MODE DELPHI}{$H+}
4+
5+
uses
6+
{$IFDEF UNIX}{$IFDEF UseCThreads}
7+
cthreads,
8+
{$ENDIF}{$ENDIF}
9+
Horse,
10+
Horse.BasicAuthentication,
11+
SysUtils;
12+
13+
procedure GetPing(Req: THorseRequest; Res: THorseResponse; Next: TNextProc);
14+
begin
15+
Res.Send('Pong');
16+
end;
17+
18+
procedure OnListen(Horse: THorse);
19+
begin
20+
Writeln(Format('Server is runing on %s:%d', [Horse.Host, Horse.Port]));
21+
end;
22+
23+
function DoLogin(const AUsername, APassword: string): Boolean;
24+
begin
25+
Result := AUsername.Equals('user') and APassword.Equals('password');
26+
end;
27+
28+
begin
29+
THorse.Use(HorseBasicAuthentication(DoLogin));
30+
31+
THorse.Get('/ping', GetPing);
32+
33+
THorse.Listen(9000, OnListen);
34+
end.

0 commit comments

Comments
 (0)