HTTP and MVC

HTTP:

  • Request
    • verb/method (GET or POST)
    • url
    • parameters
  • Response
    • status code (200, 301, 404, 500)
    • payload
  • Stateless: we have to rebuild the world at every request.

MVC:

  • Model, View, Controller
  • Controller
    • routes to appropriate action based on request
    • action my talk to model, and then either redirect (301) or render view (200) as the response

Important Sinatra concepts:

  • Rendering template allows access by template to ivars set up in action
  • Template have access seeeion hash
  • session
  • params