Notice: The website is currently being udpated. Sorry for any inconvenience.

Advanced Rack Topics

Coming soon!

Rack is a meta-framework used to simplify servers and frameworks/applications communicating. Read some interesting bits in this InfoQ article Rack: HTTP request handling made easy.

Using Halcyon to back web apps

Since Halcyon apps are simply Rack applications, using Halcyon selectively behind your larger web application can be handy. For example, your Halcyon application can map to /api/... and provide a public API to your fancy application.

In order to do this, a Rack middleware will need to be defined in order to make sure that requests get routed to both your web application and your Halcyon application depending on the correct request URL. There are two primary ways to do this:

  1. Look for a specific URL pattern and route to your Halcyon app, failing over to your web app; or
  2. Use the Cascade middleware already built into Rack which tries each app in its array until it finds an app that doesn’t throw back a 404 Not Found error.

Both of these are simple and effective methods, so both will be covered.

Custom Middleware

Look at Ezra Zygmuntowicz’ MountainWest Ruby Conf video for a good example, around 18 minutes in.

Coming soon!

Using Cascade

Refer to Rack::Cascade.

Coming soon!

Writing Custom Middleware

Vidar Hokstad has several great Rack middleware examples you should check out.

Coming soon!

Useful Rack Middleware

This list will contain articles on and links to Rack middleware that you may find interesting or useful: