Everyone.
So in this video before we started explaining anything in flask or any any of these web applications
tools basically we need to really understand what's happening in the web.
Right.
Because if you don't understand what's happening how what happens for example when you write your ad
in your browser and you click enter then you're not you're not going to be able to build a web service
because it all depends on the understanding of the whole entire process.
OK so let's start.
Let's suppose that this is your browser.
OK.
So this is your browser over here.
So your browser and this is the area where you put in your show.
So you're right you know I mean dot Google dot com and you click enter.
So what's the first step that happens when you click enter.
Well the first step is your browser takes your file and then sends it to your ISP.
So what is an ISP or less less.
You know the ISP here buy a box and a speech or something like Verizon if you're living in the U.S.
or AT&T or you know any service ISP basically X stands for Internet service provider.
So this ISP takes in this Google dot com and they and then says OK you're like your browser is looking
to do you know where Google dot com is.
Right.
So it has a list so it doesn't process called a DNS lookup OK.
So it has a bunch of big big big table.
OK.
And it's not only that the your browser or your ISP that has it's all ISP in the world have it have
it.
And this table is basically made of many fields but the fields we're interested about is the house name
and the IP address.
So you should know that in the Internet any document that is on the Internet has has a unique IP.
So none of the other documents can have the same IP only this document can have that IP just like a
list like a hostname you can't have two web sites which are called Google match.com or you can't have
two web sites that are called you know Facebook dot com.
So each web site has its unique IP address.
So your ISP takes your Google Blackcomb and then says OK I'm.
Is this Google dot com.
No this Housh hostname is not and then looks looks keeps looking until it finds Oh here's Google that.
And then it has some IP was called that IP here.
So it takes that IP address and then says OK I'm going to send it back to your browser.
OK great now your browser takes that IP address some browsers cache it for later.
So that instead of doing this whole process again every time you write google that come your browser
doesn't want to go to your ISP and then make it look for all that.
And that's that's a long process so maybe we can see which Web sites you usually visit like Google dot
com or Facebook if you if you go to Facebook and then it caches it is stores.
But this is not really important.
It's just for your information.
So the important thing is we have this IP address now right.
This IPs with us which is exactly where on the Internet on the worldwide internet you this Google dot
com is located.
OK.
Now your browser takes in this IP and sends and HTP request so it sends an HDTV request.
So what does an HDTV request mean.
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
you know there's also a lead.
These put all sort of 80 could be request protocols.
But basically for since you want to access Google dot com then you want to get this Google dot com page.
So you just your browser basically does a get request on that IP address.
And then this IP address is located in a web server.
So this is Google's.
OK.
Web server.
Pretty sure it's much bigger than this.
But let's just assume this is Google's web server.
It's very small.
So once a Google server once the Google server receives your HDTV request and this is very important
right because this is what we're going to be programming in most of the scores once it receives your
request and it takes the request OK and then it prepares a response prepare a response.
So what's the response in this case.
Well that could be the Google or the index.
HVM El-Fadl right.
Because when you when you when you click on the Google dot com enter then you get a page right which
shows you know Google Sites logo and shows the search here and I'm feeling lucky and so on.
So this is basically HMO right.
So in response to you what you're looking for is this page right here index East in MA.
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
like a Jason or it can be even an SNL file and you don't really care about X a mouse.
What we do care about Jason's.
But just keep in mind that the server receives your request it prepares a response right.
It does some computation inside and it prepares a response and then that response could be you know
any resource basically in a page.
So once we have this response then the server replies you with that response.
So it sends back send back the response.
So once you get the response which is your index issued him out page which for Google then your browser
takes it.
And like oh OK I'm seeing h DeMello so I'm going to change that into a visual form.
And so it takes for example a header or an image for Google for example puts it here and then puts the
text bar here and pushed two buttons over here and basically colors everything just like the indexed
SDMI phials is asking for.
So to recap super quickly your browser once you click Google look on it sends it to if you don't have
google.com stored in your cache.
Then you need to go to your ISP.
Your ISP does a DNS lookup for you.
It gets the IP for that Web site and then you take that IP address you send that HTP request to the
server which is indicated by this IP address and then the server prepares a response for you which could
be an index of each DML Jaison which we're about.
Talk about a lot.
And then once it has this response then it sends it back to you.
And that's basically the whole process off you know.
And usually people who write this are called web or back and engineers so people who handle these types
of back and stuff on the servers are called back and engineers.
So most of our work is actually going to be in this case in this year regarding where we're building
and the API or a web service.
So we're getting a request from other people.
We have to parse their request understand what they're what they're asking us to do and then prepare
that response which in our case is going to be a Jasen not a index of HMO.
So we're prepared a response and we send it back to them so that they're happy.
Right.
Whether there are customers or or employer whether OK so in the previous video we both are using flask.
We built a web app web service which basically when we wrote we wrote that your L went to seven point
zero point zero point one.
Five thousand I remember.
Slash OK.
And then once we clicked that then we saw Hello world.
So what really happened here.
Well once we wrote this you are all in this in in our browser this you are actually is a very special
type of IP.
This is an IP here.
This IP is basically our local host.
So our local host means it's our own computer.
So this IP response to our own computer.
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
from.
Right.
So when we did flask run the flask is very nice because flask has already in it a web server.
So once we click flask run then it sets up a web server for us.
So at the Y runs on the server sets up a local server and its location is one to seven point zero point
zero point one.
And it's listening on 4 x 5000.
So once I click this that actually my browser sent my HTC request to my computer my own computer.
So my browser sends that HTP request to my server here which is at IPY now my X Y gets this request
and then says OK if I get a request at slash which is here we're getting a request at slash right.
If I get a request at slash then I'm going to return the user simply Hello world.
So hear this hello world.
Is our response that we prepared right.
Very short response.
And then once we return this response then it takes it back to our browser.
So this is our browser here and then our browser displayed it for us.
And it showed.
Hello world.
Displayed on the screen.
So to recap flask is supersmart.
It has inside of it built in server so we don't need to know where.
We're still basically learning and developing something off line so we don't want to have to keep putting
it on our real online server deploy everything and then code there is going to be very tedious to just
change something and then put all the code again on that web server she's on line here.
And then test it and then change a few lines and then put it here.
So this is a very tedious process.
So instead what we do is we do a local server.
So we set up a server on our machine.
We simulate what would happen if this application was online and then we say if I get a request at my
own computer from my own computer.
Notice that nobody can access this year except you if you get this you are here to anybody outside.
Then you would basically be going to his own computers localhost.
So it doesn't make any sense right.
So nobody can access this except use only for testing purposes.
So once you get a request on this your browser sends a request to this IP which is which is basically
a server that is listening there and then it picks up and up you picks up the request it returns.
Hello world.
It parses the request and it returns the response and then the response is given to the browser and
it's displayed on the browser.
So yeah hopefully this video was clear.
Make sure you understand it.
One hundred thousand percent before going on to the next videos because this is really one of the most
important videos in the whole tutorial because if you understand this then you would understand the
whole process and off of the whole development cycle that we're going to go through.
So hopefully this video is clear if you have any questions on this section.
Make sure to put it on the queue and they don't.
Don't move forward until you understand this whole Web Web site go from scratch.
Yeah.
Thanks for watching and I'll see you in the next video.