httpsearch.pas 667 B

12345678910111213141516171819202122232425262728293031323334
  1. program httpsearch;
  2. // Undefine this to make a standalone HTTP server.
  3. // The standalone HTTP server listens on port 3010,
  4. // Change DefaultPort below to change this port.
  5. {$define usecgi}
  6. uses
  7. {$ifdef usecgi}
  8. fpcgi,
  9. {$else}
  10. fphttpapp,
  11. {$endif}
  12. httpdefs, httproute, httpsearcher;
  13. {$ifndef usecgi}
  14. Const
  15. DefaultPort = 3010;
  16. {$ENDIF}
  17. Var
  18. aSearch : THTTPSearcher;
  19. begin
  20. aSearch:=THTTPSearcher.Create(Application);
  21. HTTPRouter.RegisterRoute('/search',@aSearch.HTMLSearch,true);
  22. HTTPRouter.RegisterRoute('/list',@aSearch.WordList,False);
  23. {$ifndef usecgi}
  24. Application.Port:=DefaultPort;
  25. {$endif}
  26. Application.Initialize;
  27. Application.Run;
  28. end.