Abhishek Yadav
@h6165
What happens when we type www.google.com in browser
What happens when we type www.google.com in browser
server
browser
request
response
client-server communication, where client = browser
The client and server must agree on a language for communication
That language here is http
server
browser
http request
http response
GET http://www.google.co.in/
HTTP request example
HTTP response example
HTTP response example
The response wraps up a lot of data
It could be html, css or javascript files, or a combination
server
browser
http request
http response
(html,css, js)
server
browser
http request
http response
(html,css, js)
browser's job | send request: formulate the 'GET google.com' display response: render the html, css, execute javascript |
server's job | - parse the request, - find the correct files/process to handle the request - create the response as html+css+js, and send |
send request
display response
interpret request
generate response
server
browser
http request
http response
(html,css, js)
send request
display response
interpret request
generate response
Ruby on Rails
we are here
Static websites
Static websites
<html>
<head>
<title> HI </title>
</head>
<body>
<h1> Hello World </h1>
</body>
</html>
Static websites: add some css
<html>
<head>
<title> HI </title>
<style type="text/css">
.my-style{
color: red;
}
</style>
</head>
<body>
<h1 class='my-style'> Hello World </h1>
</body>
</html>
Static websites: add some javascript
<html>
<head>
<title> HI </title>
<style type="text/css">
.my-style{
color: red;
}
</style>
</head>
<body>
<h1 class='my-style'> Hello World </h1>
<script type="text/javascript">
alert("Hello World");
</script>
</body>
</html>
Serve it locally
ruby -run -e httpd . -p 8000
Web applications
Web applications
Web applications