Web Programming - Part 1: Rails
# Web Programming
# The Plan
# Homework * Some * But not graded
# Software
railsinstaller.org
aptana.org
google.com/chrome
# Your app
# Start the server
## In your browser http://localhost:3000
# Try it!
# What happened?
# Let's ask chrome
View > Dev > Tools > Network
# HTTP * How computers on the internet talk to eachother * How your browser talks to the internet * How your browser talks to your Rails app
# A GET
* Browser: Ohai, can I get an expense list? * Server: Sure, one sec * Server: Okay, here it is, it's an HTML file, btw. * Server: (attachment: expenses.html)
            > GET /expenses HTTP/1.1

            HTTP/1.1 200 OK
            Content-Type: text/html;charset=utf-8
            Content-Length: 2959
            Connection: keep-alive
            Server: thin 1.3.1

            
            ...
          
# A POST
* Browser: I'm back, can you keep this somehere safe for me? * Browser: It's a new expenses document. * Browser: (attachment: expense form data) * Server: Sure, got it. * Server: Do you want to see a list of all the expense documents?
            > POST /expenses HTTP/1.1
            > Content-Type:
            >   application/x-www-form-urlencoded
            > Content-Length: 39
            >
            > description=Lunch+with+mom&amount=2.50

            HTTP/1.1 302 Found
            Location: /expenses
          
# Also DELETE and PUT
Meanwhile inside Rails...
# HTML ## The web's Word doc
# Boilerplate
            <!DOCTYPE html>
            <html>
              <head>
                <title>My awesome page</title>
              </head>
              <body>
                <p>Hello world!</p>
              </body>
            </html>
          
# Things that do stuff
# Links Click me
# Images
# Forms
# Make it pretty # with CSS

Some stuff

Some stuff

Some stuff

Some stuff

# Mixing classes

Warning!

# Try it!
# More at http://reference.sitepoint.com/css
# Next: Ruby tryruby.org