Super basic webserver code for proof of concept. I just used the Lazarus bundled fphttpserver stuff framework
program AWebServer_lazarus;
{$mode objfpc}{$H+}
uses
SysUtils, fphttpapp, httpdefs, httproute, fpwebfile;
procedure root_redirect(aRequest : TRequest; aResponse : TResponse);
begin
aResponse.Code := 301;
aResponse.SetCustomHeader('Location', 'site/index.html');
aResponse.SendContent;
end;
begin
Application.Port := 9080;
RegisterFileLocation('site', 'site');
MimeTypesFile := 'mime.types';
HTTPRouter.RegisterRoute('/', @root_redirect);
Application.Threaded := false;
Application.Initialize;
WriteLn('Server is ready on port ' + IntToStr(Application.Port));
Application.Run;
end.
Have to copy mime.types into the same directory as the executable.
I plan to use this as a base for an auto-sync tool since I keep having issues with MarranoFTP