Node | The Internet & HTTP Server

july

ME

Antoine Bernier
@abernier

πŸ‘¨πŸ»β€πŸ’»β€‹

πŸ‘ portfolio: be.net/abernier

πŸ‘‹ WHAT ABOUT YOU?

πŸ‘©β€πŸ’»πŸ‘¨πŸ½β€πŸ’»

πŸ‘¨πŸΌβ€πŸ’»πŸ‘©πŸΎβ€πŸ’»

TOC

🌍

HTTP

DNS

πŸ’½

πŸ’»

πŸ“„

πŸ“„

🌍

?

πŸ“„

🌍

πŸ’»

πŸ“„

🌍

πŸ’»

⚑electricity

πŸ“„

🌍

πŸ’»

⚑electricity

πŸ›° internet

πŸ“„

🌍

πŸ’»

⚑electricity

πŸ“« Β address

πŸ›° internet

πŸ’»

πŸ“„

πŸ›Ž

WEB SERVER

πŸ’»

Ask

Deliver

a web-page

Client

Server

architecture

(ask)

(deliver)

Customer

Chef

(client)

(server)

πŸ‘¨πŸ»β€πŸ³

πŸ‘©πŸ»β€πŸ’Ό

restaurant

πŸ‘¨πŸ»β€πŸ³

πŸ‘©πŸ»β€πŸ’Ό

πŸ’πŸΌ

Waitress

πŸ‘¨πŸ»β€πŸ³

πŸ‘©πŸ»β€πŸ’Ό

πŸ’πŸΌ

πŸ›Ž

πŸ’¬

πŸ”

Request

πŸ‘¨πŸ»β€πŸ³

πŸ‘©πŸ»β€πŸ’Ό

πŸ’πŸΌ

πŸ”

Response

πŸ‘¨πŸ»β€πŸ³

πŸ‘©πŸ»β€πŸ’Ό

πŸ”

πŸ’πŸΌ

πŸ‘¨πŸ»β€πŸ³

πŸ‘©πŸ»β€πŸ’Ό

Client

Server

πŸ”

request

response

Client

Server

request

response

Request-response
cycle

πŸ“„

  1. HTML
  2. CSS stylesheet
  3. Javascript file
  4. Images
  5. custom webfonts...

πŸ“±

+33.6 09 08 40 44 19

?

πŸ’»

72.169.18.3

πŸ’»

123.98.128.9

www.facebook.com

179.60.192.38

docker build https://goo.gl/rozaGX -t foo && docker run -v ${PWD}:/home/node/app -p 3000:3000 -it foo /bin/sh
nslookup www.facebook.com

βœ… client/server

βœ… request/response

βœ… DNS lookup

http://www.ironhack.com

Client: Calls ironhack.com
Client: Hi
Server: Hi bro
Client: Can you get me index.html ?
Server: thinks
Server: Okay, here it is:
Server: <!DOCTYPE html><meta charset="utf-8"><title>Welcome</title>...

GET /index.html HTTP/1.1
Host: ironhack.com
Accept: text/html 
200 Ok
Content-Type: text/html

<!DOCTYPE html><meta charset="utf-8"><title>Welcome</title>

Request

Response

πŸ’¬

HTTP

πŸ’¬

?

  1. wait for requests
  2. understand them
  3. Execute some logic
  4. Send a response

Software extra-layer

cat <<EOF > server.js
const http = require('http');

const server = http.createServer((request, response) => {
  response.write('Hello, world!');
  response.end();
});

server.listen(3000);
EOF
curl http://localhost:3000

Outro

IronHack - Node | The Internet & HTTP Server

By Antoine BERNIER

IronHack - Node | The Internet & HTTP Server

  • 588
Loading comments...

More from Antoine BERNIER