NOTE
This file was generated by Descript <www.descript.com>
1

00:00:00,090  -->  00:00:02,910
Before we start creating websites
of our own, it pays to have a

2

00:00:02,910  -->  00:00:07,110
rough idea of what goes on in the
background when we type a URL in

3

00:00:07,110  -->  00:00:08,640
the address bar of our web browsers.

4

00:00:08,760  -->  00:00:10,920
It takes a surprising amount of work!

5

00:00:11,460  -->  00:00:14,700
For our browsers, the first step
is to find the IP address of

6

00:00:14,700  -->  00:00:15,960
the domain we want to access.

7

00:00:16,660  -->  00:00:20,640
Our browers don't use addresses like
google.com or facebook.com directly.

8

00:00:21,000  -->  00:00:24,180
Instead they use IP addresses,
which are used to identify

9

00:00:24,390  -->  00:00:26,040
internet connected devices.

10

00:00:26,190  -->  00:00:30,090
When we type the URL for a given site,
our browser has to figure out which

11

00:00:30,090  -->  00:00:32,310
IP address corresponds to that site.

12

00:00:32,640  -->  00:00:35,310
And this whole process is
called name resolution.

13

00:00:35,935  -->  00:00:40,795
To do this, the browser uses a domain
name system server, also called a DNS

14

00:00:40,795  -->  00:00:45,565
server, which checks an index of URLs
and their corresponding IP addresses.

15

00:00:45,934  -->  00:00:48,805
This index is a little like
a phone book for computers.

16

00:00:49,795  -->  00:00:52,680
For sites you've visited before,
the IP address can often be

17

00:00:52,680  -->  00:00:55,280
found in one or a local caches.

18

00:00:55,550  -->  00:00:59,209
Your browser maintains one such
cache, your operating system and your

19

00:00:59,209  -->  00:01:01,519
router also maintain caches like this.

20

00:01:01,760  -->  00:01:04,250
These helps speed up the
process of name resolution.

21

00:01:04,759  -->  00:01:07,580
But if a matching record isn't
found in one of these caches in

22

00:01:07,580  -->  00:01:09,080
your computer or in your router.

23

00:01:09,320  -->  00:01:12,140
Then it's up to your internet
service provider to tell your

24

00:01:12,140  -->  00:01:15,199
browser the IP address of the
site you're hoping to access.

25

00:01:15,560  -->  00:01:17,449
If a matching IP address is found.

26

00:01:17,670  -->  00:01:20,410
Then your browser will let
them to connect to it or rather

27

00:01:20,699  -->  00:01:22,440
connect to the server behind it.

28

00:01:22,980  -->  00:01:25,860
A lot of things happen during
this process but we don't have

29

00:01:25,860  -->  00:01:27,350
to worry too much about it.

30

00:01:27,370  -->  00:01:30,360
It's purpose is to ensure that
it reliable connection can be

31

00:01:30,360  -->  00:01:32,400
established between the two devices.

32

00:01:32,580  -->  00:01:35,130
Your browser and the server
you're connecting to.

33

00:01:35,400  -->  00:01:38,310
If a reliable connection is
established, the browser can then

34

00:01:38,310  -->  00:01:40,920
send an HTTP request to the server.

35

00:01:41,100  -->  00:01:43,890
This is where it tells the server
what it actually wants from it.

36

00:01:44,340  -->  00:01:47,940
When accessing a website, the
browser generally makes GET requests.

37

00:01:48,090  -->  00:01:52,140
These are used to ask for content from
the server, such as plain text documents,

38

00:01:52,290  -->  00:01:54,540
images, videos, or anything else.

39

00:01:55,110  -->  00:01:58,950
The request the browser makes also
includes a lot of meta information,

40

00:01:59,160  -->  00:02:00,840
such as your language preferences.

41

00:02:01,605  -->  00:02:04,995
In this request, your browser
will also send any relevant

42

00:02:05,225  -->  00:02:07,625
HTTP cookies to the server.

43

00:02:08,135  -->  00:02:11,385
Cookies are small pieces of data
stored by your browser and they

44

00:02:11,385  -->  00:02:15,215
are frequently used to preserve
information between page visits.

45

00:02:15,725  -->  00:02:19,095
Common use cases are things like
keeping track of items in a user's

46

00:02:19,115  -->  00:02:23,525
shopping cart or keeping users
logged in across several page loads.

47

00:02:23,815  -->  00:02:27,150
A GET request isn't the only
type of request we can make.

48

00:02:27,490  -->  00:02:30,160
We'll be covering some other
requests types, such as POST

49

00:02:30,360  -->  00:02:31,710
throughout the course as well.

50

00:02:32,130  -->  00:02:35,970
After our browser sends the request for
us, it's up to the site server to handle

51

00:02:35,970  -->  00:02:40,860
the request and give us back what we
asked for in the form of an HTTP response.

52

00:02:41,310  -->  00:02:43,440
As well as the actual content,
the browser requested.

53

00:02:43,740  -->  00:02:47,860
HTTP responses contain lots of other
stuff such as the time the response

54

00:02:47,860  -->  00:02:52,020
was sent, information about the
content being returned and a lot more.

55

00:02:52,765  -->  00:02:56,424
The server may not always be able to
fulfill our request and the response

56

00:02:56,424  -->  00:02:59,875
contains a line to let the browser
know the status of the request.

57

00:03:00,084  -->  00:03:03,144
This line includes the
HTTP version being used.

58

00:03:03,295  -->  00:03:07,644
A status code for the response and some
explanatory phase for the status code.

59

00:03:08,125  -->  00:03:11,635
You're probably familiar with the
404 status code, which indicates

60

00:03:11,635  -->  00:03:13,135
that a resource could not be found.

61

00:03:13,674  -->  00:03:16,435
It usually means that we're trying
to access a page which doesn't exist.

62

00:03:16,800  -->  00:03:20,640
Another important status code is
200 which means that the request was

63

00:03:20,640  -->  00:03:22,620
successful and that there were no issues.

64

00:03:23,100  -->  00:03:26,190
A lot of people think 404 is
the most common status code but

65

00:03:26,190  -->  00:03:28,560
naturally 200 is much more common.

66

00:03:28,950  -->  00:03:31,950
Assuming the server was able to
fulfill the response to view the desire

67

00:03:31,950  -->  00:03:35,579
page the browser will be served a
document as part of their response.

68

00:03:35,940  -->  00:03:39,210
Documents served in response
to website access requests are

69

00:03:39,210  -->  00:03:42,210
generally written using HTML 5.

70

00:03:42,450  -->  00:03:46,470
This document describes the structure
and meaning of the pages' content and

71

00:03:46,470  -->  00:03:49,440
would have contained links to other
resources, which will also get fetched

72

00:03:49,440  -->  00:03:51,630
by the browser with separate requests.

73

00:03:51,930  -->  00:03:55,230
That can include style sheets, which
describe the appearance of the pages'

74

00:03:55,230  -->  00:03:59,820
content, images, video files, fonts,
and potentially JavaScript files.

75

00:04:00,660  -->  00:04:05,010
For each of these, the browser has to send
additional requests to the server, just

76

00:04:05,010  -->  00:04:07,260
like it did for the HTML document itself.

77

00:04:07,710  -->  00:04:11,820
And while these additional resources
download, the browser begins constructing

78

00:04:11,820  -->  00:04:16,140
a model of the site structure using
the HTML code and starts painting

79

00:04:16,140  -->  00:04:17,909
content to the browser window.

80

00:04:18,420  -->  00:04:21,600
Once the painting is complete
and all of the sites resources

81

00:04:21,659  -->  00:04:24,900
have finished downloading, we're
left with a complete webpage.

82

00:04:25,290  -->  00:04:27,990
In this course, we'll focus
on steps three and four.

83

00:04:28,110  -->  00:04:31,230
We'll write client-side code to
interact with servers through a web

84

00:04:31,230  -->  00:04:35,340
browser, and we'll also write server
side code to handle those requests.

85

00:04:35,670  -->  00:04:38,340
Throughout the next couple of
sections we'll take a closer look

86

00:04:38,490  -->  00:04:41,280
at the technologies involved in
displaying a webpage to the user.

87

00:04:41,670  -->  00:04:44,460
Then we'll look into writing
server side code to handle user

88

00:04:44,460  -->  00:04:46,860
requests with Python and Flask.

89

00:04:47,070  -->  00:04:48,090
Thank you guys for watching.

90

00:04:48,300  -->  00:04:49,680
I'll see you in the next one.
