-
-
Save jasoncodes/404891 to your computer and use it in GitHub Desktop.
Serving simple static sites using Rack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rackup file for serving up a static site from a "public" directory | |
# | |
# Useful for chucking a static site on Heroku | |
class IndexRewriter | |
def initialize(app) @app = app end | |
def call(env) | |
env["PATH_INFO"].gsub! /\/$/, '/index.html' | |
@app.call(env) | |
end | |
end | |
use IndexRewriter | |
run Rack::File.new("public") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
nice! Updated.