Skip to content

Commit

Permalink
tutorial5 ok
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelJustin-VEDA committed Mar 12, 2019
1 parent 4762f4a commit 6935894
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 65 deletions.
25 changes: 2 additions & 23 deletions demo/tutorial5/FormBasedLoginServer.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,9 @@ program FormBasedLoginServer;
{$APPTYPE CONSOLE}

uses
djServer,
djWebAppContext,
LoginResource in 'LoginResource.pas',
LogoutResource in 'LogoutResource.pas';

procedure Demo;
var
Server: TdjServer;
Context: TdjWebAppContext;
begin
Server := TdjServer.Create(80);
try
Context := TdjWebAppContext.Create('', True);
Context.Add(TLoginResource, '/index.html');
Context.Add(TLogoutResource, '/logout');
Server.Add(Context);
Server.Start;
WriteLn('Server is running, please open http://localhost/index.html');
WriteLn('Hit any key to terminate.');
ReadLn;
finally
Server.Free;
end;
end;
LogoutResource in 'LogoutResource.pas',
MainUnit in 'MainUnit.pas';

begin
Demo;
Expand Down
25 changes: 11 additions & 14 deletions demo/tutorial5/FormBasedLoginServer.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
<UseDefaultCompilerOptions Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
Expand All @@ -31,37 +32,33 @@
<PackageName Value="LazUtils"/>
</Item1>
</RequiredPackages>
<Units Count="3">
<Units Count="1">
<Unit0>
<Filename Value="FormBasedLoginServer.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="LoginResource.pas"/>
<IsPartOfProject Value="True"/>
</Unit1>
<Unit2>
<Filename Value="LogoutResource.pas"/>
<IsPartOfProject Value="True"/>
</Unit2>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="FormBasedLoginServer"/>
</Target>
<SearchPaths>
<IncludeFiles Value="..\..\..\Indy10\Lib\Core;$(ProjOutDir)"/>
<OtherUnitFiles Value="..\..\source;..\..\..\Indy10\Lib\Core;..\..\..\Indy10\Lib\Protocols;..\..\..\Indy10\Lib\System;..\common"/>
<IncludeFiles Value="$(ProjOutDir);..\..\..\Indy10\Lib\Core"/>
<OtherUnitFiles Value="..\..\source;..\..\source\optional;..\..\..\Indy10\Lib\Core;..\..\..\Indy10\Lib\Protocols;..\..\..\Indy10\Lib\System"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="12">
Expand Down
38 changes: 10 additions & 28 deletions demo/tutorial5/FormBasedLoginServer.lpr
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
(*
Daraja Web Framework
Copyright (C) 2016 Michael Justin
Daraja Framework
Copyright (C) Michael Justin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
Expand All @@ -15,45 +16,26 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the Daraja framework without
disclosing the source code of your own applications. These activities
include: offering paid services to customers as an ASP, shipping Daraja
include: offering paid services to customers as an ASP, shipping Daraja
with a closed source product.
*)

program FormBasedLoginServer;

// note: this is unsupported example code
{$APPTYPE CONSOLE}

uses
djServer,
djWebAppContext,
LoginResource in 'LoginResource.pas',
LogoutResource in 'LogoutResource.pas';

procedure Demo;
var
Server: TdjServer;
Context: TdjWebAppContext;
begin
Server := TdjServer.Create(80);
try
Context := TdjWebAppContext.Create('', True);
Context.Add(TLoginResource, '/index.html');
Context.Add(TLogoutResource, '/logout');
Server.Add(Context);
Server.Start;
WriteLn('Server is running, please open http://localhost/index.html');
WriteLn('Hit any key to terminate.');
ReadLn;
finally
Server.Free;
end;
end;
LogoutResource in 'LogoutResource.pas',
MainUnit in 'MainUnit.pas';

begin
Demo;
end.

61 changes: 61 additions & 0 deletions demo/tutorial5/MainUnit.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
(*
Daraja Framework
Copyright (C) Michael Justin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the Daraja framework without
disclosing the source code of your own applications. These activities
include: offering paid services to customers as an ASP, shipping Daraja
with a closed source product.
*)

unit MainUnit;

interface

procedure Demo;

implementation

uses
LoginResource, LogoutResource,
djServer, djWebAppContext;

procedure Demo;
var
Server: TdjServer;
Context: TdjWebAppContext;
begin
Server := TdjServer.Create(80);
try
Context := TdjWebAppContext.Create('', True);
Context.Add(TLoginResource, '/index.html');
Context.Add(TLogoutResource, '/logout');
Server.Add(Context);
Server.Start;
WriteLn('Server is running, please open http://localhost/index.html');
WriteLn('Hit any key to terminate.');
ReadLn;
finally
Server.Free;
end;
end;

end.

0 comments on commit 6935894

Please sign in to comment.