Skip to content

Commit

Permalink
Samples Lazarus #5
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciussanchez committed Oct 4, 2021
1 parent 600d6a5 commit 3180ae9
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 32 deletions.
8 changes: 4 additions & 4 deletions boss-lock.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"hash": "d41d8cd98f00b204e9800998ecf8427e",
"updated": "2019-07-15T22:22:24.4542686-03:00",
"hash": "8a53e9cf872feaac975a8fad2c6a5af0",
"updated": "2021-10-04T08:54:27.0678585-03:00",
"installedModules": {
"github.com/hashload/horse": {
"name": "horse",
"version": "1.7.8",
"hash": "7f82adf0188b2f66e80e7a3c603558c9",
"version": "v2.0.14",
"hash": "38c6bebdc7b9712d6e5856d299289a26",
"artifacts": {},
"failed": false,
"changed": false
Expand Down
2 changes: 1 addition & 1 deletion boss.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"mainsrc": "/src",
"projects": [],
"dependencies": {
"github.com/hashload/horse": "^v2.0.0"
"github.com/hashload/horse": "^v2.0.14"
}
}
2 changes: 1 addition & 1 deletion horse_basic_auth.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<DCC_CBuilderOutput>All</DCC_CBuilderOutput>
<SanitizedProjectName>horse_basic_auth</SanitizedProjectName>
<DCC_UnitSearchPath>modules\.dcp;modules\.dcu;modules;modules\horse\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
<DCC_UnitSearchPath>$(DCC_UnitSearchPath);modules\.dcp;modules\.dcu;modules;modules\horse\src</DCC_UnitSearchPath>
<RuntimeOnlyPackage>true</RuntimeOnlyPackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Android)'!=''">
Expand Down
14 changes: 0 additions & 14 deletions samples/boss-lock.json

This file was deleted.

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

This file was deleted.

File renamed without changes.
3 changes: 2 additions & 1 deletion samples/Samples.dproj → samples/delphi/Samples.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
<DCC_K>false</DCC_K>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)</DCC_Namespace>
<SanitizedProjectName>Samples</SanitizedProjectName>
<DCC_UnitSearchPath>modules\.dcp;modules\.dcu;$(DCC_UnitSearchPath);modules;modules\horse\src</DCC_UnitSearchPath></PropertyGroup>
<DCC_UnitSearchPath>..\..\src;..\..\modules\horse\src;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<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>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
Expand Down
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"/>
<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>
34 changes: 34 additions & 0 deletions samples/lazarus/Console.lpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
program Console;

{$MODE DELPHI}{$H+}

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

procedure GetPing(Req: THorseRequest; Res: THorseResponse; Next: TNextProc);
begin
Res.Send('Pong');
end;

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

function DoLogin(const AUsername, APassword: string): Boolean;
begin
Result := AUsername.Equals('user') and APassword.Equals('password');
end;

begin
THorse.Use(HorseBasicAuthentication(DoLogin));

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

THorse.Listen(9000, OnListen);
end.

0 comments on commit 3180ae9

Please sign in to comment.