Intro to Sinatra
These are the resources of a talk I gave at pghrb June 7, 2012.
- Ruby (this presentation uses v1.9.2)
- Sinatra (v1.3.2)
Really really should have:
- Git (version control)
- Bundler (gem management)
Recommended to have soon:
- Heroku account (free ruby hosting to get your apps up on the internets) - Instructions for Sinatra
Examples in this repo
The examples in this order reuse concepts from the previous examples and add new concepts with each one.
examples/hello_world: Has one page that renders text.
instructions.txthas the commands that I typed to get this up and running and what they do.
examples/route_patterns: An example of using pattern matching in a route and the resulting match param value in the output.
examples/templates: An example of rendering an erb template using a value from the route params.
examples/http_verbs: An example of having a GET route and a POST route doing different things and using a form for the POST route. Also uses a layout named index.erb.
The examples are licensed MIT.
Examples of Sinatra in action
- Speed of Animals (code)
- Sinatra at LinkedIn - a talk more about JRuby but touches on their use of Sinatra
- rstat.us did, until we started rebuilding rails. See the code at an old commit
- Many many more! Sinatra in the wild