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
π
- HTML
- CSS stylesheet
- Javascript file
- Images
- 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
π¬
?
- wait for requests
- understand them
- Execute some logic
- 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
- 1,292