SOFTWARE ENGINEER @ DELIVEROO
say hi: @krissygoround
say hi: @krissygoround
say hi: @krissygoround
say hi: @krissygoround
say hi: @krissygoround
say hi: @krissygoround
say hi: @krissygoround
1991: HTTP/0.9
Minimal, one line GET request & a simple HTML response. Hello World Wide Web!
1996: HTTP/1.0
Request/response headers, useful status codes, HTTP version specification - enabling content negotiation.
<html> I'm a menu in a simple HTML (HyperText Markup Language) document. ... </html>
GET /menu
STATUS 200 OK
Date: Sun, 18 Sep 2016 12:30:54 GMT
...
<html>...
GET /menu HTTP/1.0
Accept-Language: en-gb ...
STATUS 500 INTERNAL SERVER ERROR
{
"error": "SORRY, NO ROOM!!1"
}
say hi: @krissygoround
STATUS 501 NOT IMPLEMENTED Date: Sun, 18 Sep 2016 12:30:54 GMT { "code": "123-NO-PRAMS", "message": "Due to space restrictions, the restaurant garden can not accommodate prams.", "more_info": "http://brunchlove.com/faq#prams" }
say hi: @krissygoround
say hi: @krissygoround
say hi: @krissygoround
HTTP 1.0 REQUIRED OPENING/CLOSING A TCP CONNECTION FOR EVERY REQUEST MADE.
MAKING A REQUEST IS EXPENSIVE (TIME-WISE).
THIS WAS OK BACK THEN WHEN WEBSITES WERE MORE LIGHTWEIGHT.
say hi: @krissygoround
taco.com (1996)
~47 requests
deliveroo.co.uk (2016)
~88 requests
some workarounds: precompiling assets into one to reduce requests, image compression, minification, caching...
say hi: @krissygoround
BETWEEN 1997-1999,
HTTP 1.1 WAS DEVELOPED WITH A PLETHORA OF IMPROVEMENTS.
ONE BEING THE ABILITY TO MAKE SEVERAL REQUESTS OVER ONE TCP CONNECTION. YAY!
say hi: @krissygoround
say hi: @krissygoround
STATUS 200 OK
Date: Sun, 18 Sep 2016 12:30:54 GMT
...
{
"type": "Brunch",
"items": [
{
"id": 123,
"name": "Potato Pancakes",
"price": "8.99"
},
...
]
}
GET /menu?type=brunch
say hi: @krissygoround
GET /menu?type=brunch
STATUS 200 OK Date: Sun, 18 Sep 2016 12:30:54 GMT Cache-Control: private, max-age=2592000 Last-Modified: 10 Jun 2016 10:00:00 GMT Etag: "15f0fff99ed5aae4edffdd6496d7131f" ... { "type": "Brunch", "items": [ { "id": 123, "name": "Potato Pancakes", "price": "8.99" }, ... ] }
say hi: @krissygoround
GET /menu?type=brunch If-Modified-Since: 10 Jun 2016 10:00:00 GMT
STATUS 304 NOT MODIFIED
GET /menu?type=brunch If-None-Match: "15f0fff99ed5aae4edffdd6496d7131f"
or:
say hi: @krissygoround
def show
@menu = Menu.find(params[:id])
expires_in(5.minutes, "must-revalidate": true, public: false)
# responds with 304 if not stale
if stale?(@menu, public: false)
render json: MenuSerializer.new(@menu)
end
end
That's seriously it. ^
(NB: not "all" of it - HTTP caching is quite the giant topic!)
say hi: @krissygoround
say hi: @krissygoround
BUILD THE TYPE OF SERVICE YOU WOULD ENJOY INTERACTING WITH AGAIN.
LEAVE YOUR CLIENTS HAPPY,
NOT HANGRY.
say hi: @krissygoround
say hi: @krissygoround