Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Build Sinatra App

Resource: http://www.sinatrarb.com/intro.html

1. Sinatra Hello World!

#myapp.rb
require 'sinatra'

get '/' do
  'Hello World!'
end

Install the sinatra gem by running the following command in the terminal gem install sinatra

  • Start the sinatra server in terminal by running ruby myapp.rb

  • Navigate to http://localhost:4567 in browser

  • When you are finished stop the sever by pressing control + c

2. Install Twitter Bootstrap

  • Visit http://getbootstrap.com/ and click download button.

  • Create and public/ and views/ folders in you sinatra app's root directory

  • Unzip the bootstrap download and move the css, fonts, and js folders into you sinatra app's public folder.

  • Visit http://getbootstrap.com/getting-started/#examples grab an eample template.

  • Create a new file index.erb and paste contents of example tbs tempate changing css and js to use correct relative paths.

  • Map the '/' route to your new template

# myapp.rb
require 'sinatra'

get '/' do
  erb :index
end

3. Final Test!