WEBVTT

00:05.050 --> 00:06.010
Everyone.

00:06.190 --> 00:12.760
So in this video before we started explaining anything in flask or any any of these web applications

00:14.350 --> 00:18.850
tools basically we need to really understand what's happening in the web.

00:18.850 --> 00:19.500
Right.

00:19.540 --> 00:24.570
Because if you don't understand what's happening how what happens for example when you write your ad

00:24.640 --> 00:30.020
in your browser and you click enter then you're not you're not going to be able to build a web service

00:30.080 --> 00:34.720
because it all depends on the understanding of the whole entire process.

00:34.720 --> 00:36.000
OK so let's start.

00:36.160 --> 00:38.680
Let's suppose that this is your browser.

00:38.680 --> 00:39.090
OK.

00:39.160 --> 00:41.240
So this is your browser over here.

00:41.350 --> 00:46.740
So your browser and this is the area where you put in your show.

00:46.780 --> 00:54.190
So you're right you know I mean dot Google dot com and you click enter.

00:54.430 --> 00:57.920
So what's the first step that happens when you click enter.

00:58.180 --> 01:06.810
Well the first step is your browser takes your file and then sends it to your ISP.

01:06.820 --> 01:09.410
So what is an ISP or less less.

01:09.430 --> 01:17.170
You know the ISP here buy a box and a speech or something like Verizon if you're living in the U.S.

01:17.170 --> 01:25.330
or AT&amp;T or you know any service ISP basically X stands for Internet service provider.

01:25.420 --> 01:34.320
So this ISP takes in this Google dot com and they and then says OK you're like your browser is looking

01:34.380 --> 01:37.190
to do you know where Google dot com is.

01:37.200 --> 01:37.960
Right.

01:38.010 --> 01:44.600
So it has a list so it doesn't process called a DNS lookup OK.

01:44.940 --> 01:48.240
So it has a bunch of big big big table.

01:48.300 --> 01:49.070
OK.

01:49.410 --> 01:56.310
And it's not only that the your browser or your ISP that has it's all ISP in the world have it have

01:56.310 --> 01:56.820
it.

01:57.270 --> 02:03.740
And this table is basically made of many fields but the fields we're interested about is the house name

02:06.080 --> 02:09.030
and the IP address.

02:09.140 --> 02:16.340
So you should know that in the Internet any document that is on the Internet has has a unique IP.

02:16.430 --> 02:22.580
So none of the other documents can have the same IP only this document can have that IP just like a

02:22.640 --> 02:27.200
list like a hostname you can't have two web sites which are called Google match.com or you can't have

02:27.200 --> 02:31.780
two web sites that are called you know Facebook dot com.

02:31.820 --> 02:35.720
So each web site has its unique IP address.

02:36.020 --> 02:41.700
So your ISP takes your Google Blackcomb and then says OK I'm.

02:41.840 --> 02:43.090
Is this Google dot com.

02:43.100 --> 02:50.830
No this Housh hostname is not and then looks looks keeps looking until it finds Oh here's Google that.

02:52.790 --> 02:56.130
And then it has some IP was called that IP here.

02:56.330 --> 03:03.190
So it takes that IP address and then says OK I'm going to send it back to your browser.

03:04.590 --> 03:10.810
OK great now your browser takes that IP address some browsers cache it for later.

03:10.830 --> 03:16.110
So that instead of doing this whole process again every time you write google that come your browser

03:16.140 --> 03:19.920
doesn't want to go to your ISP and then make it look for all that.

03:19.920 --> 03:25.220
And that's that's a long process so maybe we can see which Web sites you usually visit like Google dot

03:25.220 --> 03:29.980
com or Facebook if you if you go to Facebook and then it caches it is stores.

03:30.030 --> 03:31.650
But this is not really important.

03:31.700 --> 03:33.430
It's just for your information.

03:33.450 --> 03:37.350
So the important thing is we have this IP address now right.

03:37.380 --> 03:45.620
This IPs with us which is exactly where on the Internet on the worldwide internet you this Google dot

03:45.620 --> 03:46.980
com is located.

03:47.430 --> 03:48.150
OK.

03:48.360 --> 04:01.480
Now your browser takes in this IP and sends and HTP request so it sends an HDTV request.

04:01.850 --> 04:04.230
So what does an HDTV request mean.

04:04.370 --> 04:14.450
What we're going to be talking a lot about it but for now you can get get one of these get or post or

04:14.480 --> 04:16.710
you know there's also a lead.

04:16.860 --> 04:20.800
These put all sort of 80 could be request protocols.

04:20.930 --> 04:29.580
But basically for since you want to access Google dot com then you want to get this Google dot com page.

04:29.660 --> 04:36.400
So you just your browser basically does a get request on that IP address.

04:36.710 --> 04:42.460
And then this IP address is located in a web server.

04:42.620 --> 04:44.740
So this is Google's.

04:45.090 --> 04:45.770
OK.

04:46.680 --> 04:47.690
Web server.

04:47.970 --> 04:49.820
Pretty sure it's much bigger than this.

04:49.830 --> 04:52.440
But let's just assume this is Google's web server.

04:52.450 --> 04:53.830
It's very small.

04:53.910 --> 05:00.930
So once a Google server once the Google server receives your HDTV request and this is very important

05:00.930 --> 05:05.910
right because this is what we're going to be programming in most of the scores once it receives your

05:05.910 --> 05:14.650
request and it takes the request OK and then it prepares a response prepare a response.

05:14.790 --> 05:16.680
So what's the response in this case.

05:16.800 --> 05:21.490
Well that could be the Google or the index.

05:21.760 --> 05:23.570
HVM El-Fadl right.

05:23.610 --> 05:29.190
Because when you when you when you click on the Google dot com enter then you get a page right which

05:29.190 --> 05:35.960
shows you know Google Sites logo and shows the search here and I'm feeling lucky and so on.

05:36.120 --> 05:38.160
So this is basically HMO right.

05:38.160 --> 05:43.990
So in response to you what you're looking for is this page right here index East in MA.

05:44.430 --> 05:50.700
But we're also going to see later in the video that responsa doesn't have to be a page it can be a file

05:50.790 --> 05:58.500
like a Jason or it can be even an SNL file and you don't really care about X a mouse.

05:58.510 --> 06:00.380
What we do care about Jason's.

06:00.480 --> 06:06.230
But just keep in mind that the server receives your request it prepares a response right.

06:06.240 --> 06:12.270
It does some computation inside and it prepares a response and then that response could be you know

06:12.360 --> 06:15.650
any resource basically in a page.

06:15.840 --> 06:24.220
So once we have this response then the server replies you with that response.

06:24.330 --> 06:28.410
So it sends back send back the response.

06:30.930 --> 06:37.710
So once you get the response which is your index issued him out page which for Google then your browser

06:37.710 --> 06:38.210
takes it.

06:38.220 --> 06:43.900
And like oh OK I'm seeing h DeMello so I'm going to change that into a visual form.

06:43.990 --> 06:51.720
And so it takes for example a header or an image for Google for example puts it here and then puts the

06:51.810 --> 06:58.420
text bar here and pushed two buttons over here and basically colors everything just like the indexed

06:58.600 --> 07:01.500
SDMI phials is asking for.

07:01.500 --> 07:08.130
So to recap super quickly your browser once you click Google look on it sends it to if you don't have

07:08.250 --> 07:10.610
google.com stored in your cache.

07:10.620 --> 07:12.290
Then you need to go to your ISP.

07:12.300 --> 07:15.510
Your ISP does a DNS lookup for you.

07:15.510 --> 07:22.980
It gets the IP for that Web site and then you take that IP address you send that HTP request to the

07:22.980 --> 07:30.060
server which is indicated by this IP address and then the server prepares a response for you which could

07:30.060 --> 07:33.530
be an index of each DML Jaison which we're about.

07:33.540 --> 07:34.830
Talk about a lot.

07:34.830 --> 07:39.850
And then once it has this response then it sends it back to you.

07:40.350 --> 07:44.350
And that's basically the whole process off you know.

07:44.430 --> 07:52.080
And usually people who write this are called web or back and engineers so people who handle these types

07:52.080 --> 07:56.380
of back and stuff on the servers are called back and engineers.

07:56.670 --> 08:04.350
So most of our work is actually going to be in this case in this year regarding where we're building

08:04.410 --> 08:06.870
and the API or a web service.

08:06.900 --> 08:09.590
So we're getting a request from other people.

08:09.810 --> 08:15.810
We have to parse their request understand what they're what they're asking us to do and then prepare

08:15.810 --> 08:20.780
that response which in our case is going to be a Jasen not a index of HMO.

08:21.150 --> 08:25.330
So we're prepared a response and we send it back to them so that they're happy.

08:25.350 --> 08:25.670
Right.

08:25.680 --> 08:35.050
Whether there are customers or or employer whether OK so in the previous video we both are using flask.

08:35.200 --> 08:42.670
We built a web app web service which basically when we wrote we wrote that your L went to seven point

08:42.670 --> 08:44.910
zero point zero point one.

08:45.520 --> 08:48.060
Five thousand I remember.

08:48.220 --> 08:49.770
Slash OK.

08:50.260 --> 08:53.820
And then once we clicked that then we saw Hello world.

08:53.830 --> 08:56.080
So what really happened here.

08:56.080 --> 09:05.890
Well once we wrote this you are all in this in in our browser this you are actually is a very special

09:05.890 --> 09:07.500
type of IP.

09:07.510 --> 09:10.300
This is an IP here.

09:10.510 --> 09:13.710
This IP is basically our local host.

09:13.900 --> 09:17.330
So our local host means it's our own computer.

09:17.380 --> 09:20.150
So this IP response to our own computer.

09:20.320 --> 09:26.080
So we don't need to do any DNS look up on this on this IP here because we already know where where it's

09:26.080 --> 09:26.580
from.

09:26.590 --> 09:27.490
Right.

09:27.550 --> 09:36.290
So when we did flask run the flask is very nice because flask has already in it a web server.

09:36.430 --> 09:40.830
So once we click flask run then it sets up a web server for us.

09:41.900 --> 09:51.080
So at the Y runs on the server sets up a local server and its location is one to seven point zero point

09:51.080 --> 09:52.000
zero point one.

09:52.130 --> 09:56.230
And it's listening on 4 x 5000.

09:56.280 --> 10:05.170
So once I click this that actually my browser sent my HTC request to my computer my own computer.

10:05.550 --> 10:15.360
So my browser sends that HTP request to my server here which is at IPY now my X Y gets this request

10:16.460 --> 10:23.640
and then says OK if I get a request at slash which is here we're getting a request at slash right.

10:23.960 --> 10:30.660
If I get a request at slash then I'm going to return the user simply Hello world.

10:32.740 --> 10:35.260
So hear this hello world.

10:35.290 --> 10:38.470
Is our response that we prepared right.

10:38.470 --> 10:40.110
Very short response.

10:40.540 --> 10:45.560
And then once we return this response then it takes it back to our browser.

10:45.580 --> 10:50.080
So this is our browser here and then our browser displayed it for us.

10:50.080 --> 10:51.340
And it showed.

10:51.340 --> 10:52.830
Hello world.

10:53.650 --> 10:55.390
Displayed on the screen.

10:56.020 --> 10:59.120
So to recap flask is supersmart.

10:59.140 --> 11:03.930
It has inside of it built in server so we don't need to know where.

11:03.930 --> 11:09.460
We're still basically learning and developing something off line so we don't want to have to keep putting

11:09.460 --> 11:16.660
it on our real online server deploy everything and then code there is going to be very tedious to just

11:16.660 --> 11:21.540
change something and then put all the code again on that web server she's on line here.

11:21.730 --> 11:26.570
And then test it and then change a few lines and then put it here.

11:26.620 --> 11:28.500
So this is a very tedious process.

11:28.500 --> 11:31.950
So instead what we do is we do a local server.

11:32.020 --> 11:33.990
So we set up a server on our machine.

11:34.000 --> 11:41.920
We simulate what would happen if this application was online and then we say if I get a request at my

11:41.920 --> 11:43.950
own computer from my own computer.

11:43.950 --> 11:51.620
Notice that nobody can access this year except you if you get this you are here to anybody outside.

11:51.790 --> 11:56.240
Then you would basically be going to his own computers localhost.

11:56.260 --> 11:58.400
So it doesn't make any sense right.

11:58.900 --> 12:03.050
So nobody can access this except use only for testing purposes.

12:03.070 --> 12:09.670
So once you get a request on this your browser sends a request to this IP which is which is basically

12:09.670 --> 12:16.420
a server that is listening there and then it picks up and up you picks up the request it returns.

12:16.420 --> 12:17.260
Hello world.

12:17.260 --> 12:22.720
It parses the request and it returns the response and then the response is given to the browser and

12:22.720 --> 12:24.350
it's displayed on the browser.

12:25.410 --> 12:27.530
So yeah hopefully this video was clear.

12:27.540 --> 12:28.880
Make sure you understand it.

12:28.890 --> 12:34.920
One hundred thousand percent before going on to the next videos because this is really one of the most

12:34.920 --> 12:40.800
important videos in the whole tutorial because if you understand this then you would understand the

12:40.800 --> 12:46.250
whole process and off of the whole development cycle that we're going to go through.

12:46.650 --> 12:51.270
So hopefully this video is clear if you have any questions on this section.

12:51.270 --> 12:54.180
Make sure to put it on the queue and they don't.

12:54.180 --> 12:59.240
Don't move forward until you understand this whole Web Web site go from scratch.

12:59.620 --> 13:00.260
Yeah.

13:00.690 --> 13:03.250
Thanks for watching and I'll see you in the next video.
