How the Sinatra web framework would look like in Delphi

The Ruby web framework Sinatra needs three lines of code to map a context (web address) with a HTTP GET request handler:

get '/hi' do
  "Hello World!"
end

In Delphi, I managed to implement the same with this code (see the web framework status project status here):

get(TRoute.Create('/hello',
     function(Request: TRequest; Response: TResponse): TObject
     begin
       Result := TStringBuilder.Create('Hello world!');
     end));
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s