Learning Sinatra

Learning Sinatra

2h 10mIntermediate2017-03-22

Authors

Kevin Skoglund

Kevin Skoglund

Founder of NovaFabrica

Course details

Sinatra is a lightweight web application library and domain-specific language that provides a faster and simpler alternative to Ruby frameworks such as Ruby on Rails. In this course, discover how to quickly build web applications with Sinatra. Kevin Skoglund walks through how to define routes, render templates containing dynamic data, and use partial templates and layouts to create reusable code. Plus, he explains how to use cookies, sessions, and filters, and shares useful techniques which you can leverage in your own Sinatra projects.

Learning objectives
Installing Sinatra
Launching the server
Defining routes
Using route patterns and parameters
Redirecting requests
Rendering dynamic templates
Using partial templates and layouts
Defining custom helpers

Skills covered

SinatraRubyProgramming LanguagesOpen SourceSoftware Development

Concepts

Introduction

  • Welcome
  • How to use the exercise files
  • What is Sinatra
  • Install Sinatra

Routes

  • Launch the server
  • Define routes
  • Route HTTP methods
  • Route patterns
  • Route parameters
  • Redirect requests

Templates

  • Configure file paths
  • Render static files
  • Render templates
  • Add code to a template
  • Template variables
  • Render partial templates
  • Layouts
  • Challenge - Templates
  • Solution - Templates

Helpers and Filters

  • Define custom helpers
  • Escape HTML
  • Cookies
  • Sessions
  • Filters

Useful Techniques

  • Classes
  • Form parameter array
  • Databases

Conclusion

  • Next steps
80,000 Toman