- How does the web work
- Browser creates a visual representation of a server's response (usually parsing an HTML string and rendering it)
- Browser finds the server by looking up the name (eg google.com) in DNS to get an IP Address (216.58.217.46)
ping google.com
- The machine has many programs running, they identify which one should handle it by looking at the port (eg 3000, or 80)
- The operating system sends the HTTP request to whatever program is registered on that port, this is the server, WEBrick
- The server parses the request and hands it to the application, ie
Rails.application
- You can see which application in
config.ru
(this is rack)
- The browser and the server talk to each other via HTTP
- See a web request:
nc -l 3000
and now direct your browser to http://localhost:3000/whatever.html - Now type "HTTP/1.1 302 it moved\nLocation: http://google.com\n\n"
- See a web response:
curl -i google.com
- See a web request:
- See the request
- See the response
- Where does that fit in the grand scheme of things?
- Given that, where does Rails fit in?
- When it hits the server, it comes into Rails, because we told it to in
config.ru
- When it hits the server, it comes into Rails, because we told it to in
- Now that we know what Rails does and where it fits, how does rails accomplish this?
- What are its pieces
- How do they fit together?
- Maaaaaaaaybe: what are the conventions
- https://github.com/JoshCheek/playgrounds
- Pick several of the pieces and see that we can play with them.