Skip to content

Instantly share code, notes, and snippets.

@kinopyo
Created October 21, 2011 07:13
Show Gist options
  • Save kinopyo/1303281 to your computer and use it in GitHub Desktop.
Save kinopyo/1303281 to your computer and use it in GitHub Desktop.
How to render static HTML files in Sinatra.
require 'sinatra'
get '/' do
File.read(File.join('public', 'index.html'))
# or
# send_file File.join(settings.public, 'index.html')
end
require "sinatra"
get '/' do
# File.read(File.join('public', 'index.html'))
html :index
end
def html(view)
File.read(File.join('public', "#{view.to_s}.html"))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment