Middleware to server static files in Horse
For install in your project using boss:
$ boss install github.com/cachopaweb/horse-server-static
Sample Horse Server
uses System.SysUtils,
Horse,
Horse.ServerStatic;
begin
THorse.Use(ServerStatic('public'));
THorse.Get('/ping',
procedure(Req: THorseRequest; Res: THorseResponse; Next: TProc)
begin
Res.Send('pong');
end);
THorse.Listen(9000,
procedure (App: THorse)
begin
Writeln('Server is running on port '+App.Port.ToString);
end);
end.
THorse.Use(ServerStatic('public'));
http://localhost:9000/imagem.jpg
http://localhost:9000/index.html
http://localhost:9000/css/style.css
http://localhost:9000/js/app.js
http://localhost:9000/images/bg.png