- The server file contains the routes for specific HTTP verbs, and determines what the client gets back with each request
- Two ways
- Using an instance variable:
get '/' do @ number = 100 erb :index end
- Using local variable:
get '/' do number = 100 erb (:index, :locals => {:number => number}) end
- use ERB tags. To render use in the view use
<%= RUBY_CODE %>
- To not render in the view, omit the equals sign:
<% RUBY_CODE %>
- data comes in as a hash. The hash is called
params
- params are key value pairs that contain information coming from the client through forms.
- They are stored per request, so they can change with each request that is made