Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works

Random project

Horse-Server-Status

Horse middleware to retrieve currently active requests being processed

View on GitHub

Anyone may press Interesting, signed in or not. It helps others find this project.

Member rating

No ratings yet.

Sign in to rate this project.

README

horse-server-status

Middleware for showing active routes being processed at the time in HORSE

For install in your project using boss:

bash
$ boss install arvanus/Horse-Server-Status

Sample

Sample Horse Server Status, not tested under Lazarus

pascal

uses
  System.SysUtils,
  Classes,
  Horse,
  Horse.Jhonson,
  Horse.ServerStatus;

begin
  try
 THorse
    .Use(Jhonson)
    .Use(ServerStatus);

  THorse.Get('/server-status',  ShowServerStatus);
  THorse.Get('/delay',  procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
  begin
    TThread.Sleep(5000);
    Res.Send('OK');
  end);
  THorse.Get('/delay/:bla',  procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
  begin
    TThread.Sleep(5000);
    Res.Send('OK');
  end);

  THorse.Listen(9000);
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.