Web Design
Creating Web Applications with Sinatra
Sinatra Fundamentals
Working with Sinatra

Sinatra Fundamentals

Course Number:
wd_cwas_a01_it_enus
Lesson Objectives

Sinatra Fundamentals

  • start the course
  • define Sinatra and describe its characteristics
  • describe how to install Sinatra and the Thin server on UNIX based platforms, and create and run a simple application
  • declare routes using various route verbs in Sinatra
  • configure routes to share the same handler, use parameters, including query string parameters and wildcards
  • describe how the first match is used and how routes can be matched using regular expressions in Sinatra
  • halt, pass, trigger, and redirect requests in Sinatra
  • use filters to modify requests and responses in Sinatra
  • deliver static content from default public folder and other locations without using routing
  • define inline and external templates to work with views in Sinatra
  • use instance variables to pass data to views, and use filters in Sinatra
  • generate and use ActiveRecord models in a Sinatra application
  • generate and use DataMapper models in a Sinatra application
  • configure Sinatra to send attachments to a client
  • configure content streaming including finite streaming in a Sinatra application
  • configure finite streaming in a Sinatra application
  • use the not_found and error blocks to handle errors in Sinatra
  • describe application/class scope, request/instance scope, delegation scope, and associated bindings in Sinatra applications
  • create extensions in Sinatra
  • create and use helper methods in modules in Sinatra
  • use the configure block to apply configuration in Sinatra
  • use set: or enable:key or the settings object to apply settings at class or top level in Sinatra
  • use the headers method in Sinatra to set HTTP headers in response objects to provide information to servers and clients
  • access information via the request object in Sinatra
  • set cache headers, cache control, and content expiration in Sinatra with the headers, cache_control, and expires helpers
  • define and generate ETags (entity tags) including weak ETags
  • enable and destroy sessions using the configure block and session.clear in Sinatra
  • set cookies in Sinatra
  • manage Sinatra dependencies with Bundler
  • develop and configure a basic application in Sinatra

Overview/Description
At the core of Sinatra is the ability to respond to routes. This course includes how to install and use Sinatra with the Thin server. It shows various aspects of route configuration, and covers the use of templates, views, and models, including ActiveRecord and DataMapper. It covers attachments and content streaming, as well as the basics of extensions and helpers, and dynamic modification of block binding. Finally, you'll learn about various aspects of application configuration to support features such as sessions, cookies, caching, and error handling.

Target Audience
Developers familiar with Ruby who want to use Sinatra to create web applications and services

Sinatra Fundamentals

Course Number:
wd_cwas_a01_it_enus
Lesson Objectives

Sinatra Fundamentals

  • start the course
  • define Sinatra and describe its characteristics
  • describe how to install Sinatra and the Thin server on UNIX based platforms, and create and run a simple application
  • declare routes using various route verbs in Sinatra
  • configure routes to share the same handler, use parameters, including query string parameters and wildcards
  • describe how the first match is used and how routes can be matched using regular expressions in Sinatra
  • halt, pass, trigger, and redirect requests in Sinatra
  • use filters to modify requests and responses in Sinatra
  • deliver static content from default public folder and other locations without using routing
  • define inline and external templates to work with views in Sinatra
  • use instance variables to pass data to views, and use filters in Sinatra
  • generate and use ActiveRecord models in a Sinatra application
  • generate and use DataMapper models in a Sinatra application
  • configure Sinatra to send attachments to a client
  • configure content streaming including finite streaming in a Sinatra application
  • configure finite streaming in a Sinatra application
  • use the not_found and error blocks to handle errors in Sinatra
  • describe application/class scope, request/instance scope, delegation scope, and associated bindings in Sinatra applications
  • create extensions in Sinatra
  • create and use helper methods in modules in Sinatra
  • use the configure block to apply configuration in Sinatra
  • use set: or enable:key or the settings object to apply settings at class or top level in Sinatra
  • use the headers method in Sinatra to set HTTP headers in response objects to provide information to servers and clients
  • access information via the request object in Sinatra
  • set cache headers, cache control, and content expiration in Sinatra with the headers, cache_control, and expires helpers
  • define and generate ETags (entity tags) including weak ETags
  • enable and destroy sessions using the configure block and session.clear in Sinatra
  • set cookies in Sinatra
  • manage Sinatra dependencies with Bundler
  • develop and configure a basic application in Sinatra

Overview/Description
At the core of Sinatra is the ability to respond to routes. This course includes how to install and use Sinatra with the Thin server. It shows various aspects of route configuration, and covers the use of templates, views, and models, including ActiveRecord and DataMapper. It covers attachments and content streaming, as well as the basics of extensions and helpers, and dynamic modification of block binding. Finally, you'll learn about various aspects of application configuration to support features such as sessions, cookies, caching, and error handling.

Target Audience
Developers familiar with Ruby who want to use Sinatra to create web applications and services

Working with Sinatra

Course Number:
wd_cwas_a02_it_enus
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

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

Working with Sinatra

Course Number:
wd_cwas_a02_it_enus
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

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

Close Chat Live