Working with Sinatra


Overview/Description
Target Audience
Prerequisites
Expected Duration
Lesson Objectives
Course Number
Expertise Level



Overview/Description
In common with Ruby frameworks, Sinatra uses the Rack interface. This allows it to harness the functionality of Rack and enables the generation of Sinatra applications as a combination of middleware applications. After covering more advanced features of extensions, helpers, templates, views, and databases in the context of Sinatra applications, this course covers using Rack middleware with Sinatra. It also covers generating subclasses to create modular Sinatra applications. You'll also learn how to create a REST service using Sinatra. Finally, you'll learn how to manage Sinatra dependencies and assets, reload code, and deploy applications using Heroku or Apache Passenger.

Target Audience
Developers familiar with Ruby who want to use Sinatra to build web applications

Prerequisites
None

Expected Duration (hours)
2.5

Lesson Objectives

Working with Sinatra

  • start the course
  • create and use helper methods in blocks in Sinatra
  • use Sinatra's registered method to combine helpers and extensions in an application
  • compare how to dynamically change the binding of a block in Sinatra by using instance_eval or by dynamically creating a method from the block, getting the unbound method object, and removing the method
  • implement a Rails style partial handler in a Sinatra application
  • use the CoffeeScript template in Sinatra applications
  • use RSS feed templates with builder in Sinatra applications
  • generate and use a MongoMapper model in a Sinatra application
  • connect to different databases such as SQLite and Mongo from a Sinatra application
  • describe Rack and port an application defined using Sinatra to Rack
  • use Rack middleware with Sinatra
  • demonstrate the dispatch action that Sinatra uses when running as middleware
  • implement Rack authentication in a Sinatra application
  • using Rack::Test to test a Sinatra application
  • define Sinatra::Base and use it to create a subclass and run the application in Sinatra using run
  • describe how Sinatra can subclass subclasses and describe how all elements, routes, settings, and methods are inherited by all subclasses
  • use inheritance in Sinatra to build a controller architecture
  • run a Sinatra-based modular application checking that the file containing the modular code has been executed and using config.ru
  • use Sinatra.new() to generate an anonymous modular application and show to inherit from a different superclass
  • use helpers and extensions in modular Sinatra applications
  • use a Sinatra application as middleware in front of another application
  • use Rack::Cascade to cascade applications as an alternative to a middleware chain
  • use a Rack router to combine apps as an alternative to chaining or cascading
  • describe how to work with return values in modular applications including Sinatra applications used as Rack middleware
  • create a REST service using Sinatra
  • use the Sinatra asset-pack gem to manage assets in an application
  • use the shotgun gem to enable Sinatra code to be reloaded automatically
  • use Heroku to deploy a Sinatra application
  • use Apache and Passenger to deploy Sinatra applications
  • create a REST service in Sinatra
  • Course Number:
    wd_cwas_a02_it_enus

    Expertise Level
    Beginner