Skip to content

A proof of concept: bare minimum CGI web framework for pascal

Notifications You must be signed in to change notification settings

ariaghora/minima

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minima

A bare minimum CGI web framework for pascal that supports (somewhat ¯\_(ツ)_/¯) dynamic routing. It is really minimum and straightforward. No bloat, no unnecessary abstraction. Define the routes, show what you want to show. That's it, that's all.

uses
  minima;

var
  app: TMinimaApp;

  function CtrlMain: string;
  begin
    Result := 'Hello. This is main page.';
  end;

  function CtrlUser: string;
  begin
    Result := 'Hello ' + app.RouteVars['name'] + ', ';
    Result := Result + 'Your book ID is ' + app.RouteVars['book_id'] + '. ';

    if app.ReqMethod = 'POST' then
      Result := Result + 'Pssst! This is a POST request.';
  end;

begin
  app := TMinimaApp.Create;
  app.Route('/', ['GET'], @CtrlMain);
  app.Route('/user/<name>/book_id/<book_id>', ['GET', 'POST'], @CtrlUser);
  app.Run;

  app.Cleanup;
end.

About

A proof of concept: bare minimum CGI web framework for pascal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages