BrookHTTPServer www folder lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- promisetom · 2021-04-23 00:21 Hi All, I am building a Brook HttpServer with SSE and I would like to have the css and js files served from a local folder. Where in the Brook framework do I add this location. Thanks in advance Tom ---------------------------------------------------------------------- egsuh · 2021-04-23 05:33 Aren't css and js files defined within HTML file? ---------------------------------------------------------------------- PierceNg · 2021-04-23 07:10 Quote from: egsuh on April 23, 2021, 07:33:28 amAren't css and js files defined within HTML file? Yes. They usually exist as separate files on the server. From a web server (application) perspective, they also have to be served as static content when the web browser follows the references in the HTML file and requests for these CSS and JS files. ---------------------------------------------------------------------- promisetom · 2021-04-23 23:15 In a Delphi app using Overbyte ics they have a DocDir which relates to the www folder in Apache etc. This is what I need. Tom ---------------------------------------------------------------------- promisetom · 2021-04-26 01:33 Found this idea and it works well. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.OnRequest(Sender: TObject;  var ARequest: TFPHTTPConnectionRequest;  var AResponse: TFPHTTPConnectionResponse);var  AFilename: String;begin  AFilename := ARequest.URI;  {Get rid of the starting bars so we won't serve from '/'   Theres should be only one, but just in case ...}  while AFilename.StartsWith('/') or AFilename.StartsWith('.') do    Delete(AFilename, 1, 1);  {Alternatively, one could just do:    AFilename := GeCurrentDir + AFilename;  or whatever the web-root directory is,  but that's not very secure}   { If we find the file, serve it; if not, fawn about it}  if FileExists(AFilename) then begin    AResponse.Code := 200;    AResponse.Content := ReadFileToString(AFilename);  end else begin    AResponse.Code := 404;    AResponse.Content := 'Sorry, don''t have any "' + AFilename +'"';  end;end;  from here. https://forum.lazarus.freepascal.org/index.php/topic,36178.15.html I will post a webserver demo soon. Tom