Ejemplo Simple de uso de Sinatra



[~/sinatra/sinatra-simple(master)]$ cat hi.rb 
require 'sinatra'

get '/hi' do
  "Hello World!"

Opciones de Ejecución

[~/sinatra/sinatra-simple(master)]$ ruby hi.rb --help
Usage: hi [options]
    -p port                          set the port (default is 4567)
    -o addr                          set the host (default is localhost)
    -e env                           set the environment (default is development)
    -s server                        specify rack server/handler (default is thin)
    -x                               turn on the mutex lock (default is off)
Sinatra can be used in threaded environments where more than a single request is processed at a time.

However, not all applications and libraries are thread-safe and may cause intermittent errors or general weirdness.

Enabling the -x setting causes all requests to synchronize on a mutex lock, ensuring that only a single request is processed at a time.

The mutex lock setting is disabled by default.

Casiano Rodriguez León 2015-06-18