Created
October 21, 2011 07:13
-
-
Save kinopyo/1303281 to your computer and use it in GitHub Desktop.
How to render static HTML files in Sinatra.
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
require 'sinatra' | |
get '/' do | |
File.read(File.join('public', 'index.html')) | |
# or | |
# send_file File.join(settings.public, 'index.html') | |
end |
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
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