Delphi MVC Web Framework - "Hello World"

Posted on gio 02 febbraio 2012 in Delphi XE, Delphi XE2, Design Patterns, dorm, Embarcadero, MVC, RTTI

This is the first "Hello World" for my Delphi MVC Web Framework.

``` {lang="delphi"} program DelphiMVCWebFramework;

{$APPTYPE CONSOLE}

uses System.SysUtils, MVCEngine in 'MVCEngine.pas', BaseController in 'BaseController.pas';

var mvc: TWebMVCEngine; begin mvc := TWebMVCEngine.Create; mvc.AddRoute('/', procedure(Context: TWebContext) begin Context.Write('Hello World'); end).Start(8080); ReadLn; mvc.Free; end. ```

Features list (some of them are in the internal roadmap)

  • Completely MVC
  • Addressable with servername/controllername/actionname?par1&par2
  • Addressable with servername/controllername/actionname/par1/par2
  • Can also use anonymous methods as actions for very simple app (in the sample)
  • Really RESTful (Level 3 of the Richardson Maturity Model)
  • Fully integrable into WebBroker and DataSnap
  • Supports multiple resource rapresentations
  • Completely customizable routing using internal formatting or regex
  • Inspired to ASP.NET, Sinatra, Java Spring MVC, Java Restlet
  • Scriptable views support (Pascal, Razor, Lua)
  • Component based
  • Session support
  • ORM support using dorm
  • Classic TDataSet support
  • State server to support real loadbalancing using reverse proxy
  • Can be deployed as standalone (in the example), ISAPI dll and Windows Service
  • Fully support https
  • More to come...