1
00:00:00,420 --> 00:00:06,720
We already installed the Express, and so we are going to create an express app, so the first thing

2
00:00:06,720 --> 00:00:13,100
is we are going to create a app today and we will keep the server so we can compare.

3
00:00:13,140 --> 00:00:14,580
We have this code later.

4
00:00:15,620 --> 00:00:24,260
So the first thing is we go to the top end state concern expressed equal to require express.

5
00:00:25,670 --> 00:00:32,510
And next, we are going to set up the express app so actually we can copy and paste here.

6
00:00:34,160 --> 00:00:40,400
We invoke definitions and create an instance of express app and stored in the constant app.

7
00:00:40,820 --> 00:00:45,840
And we can call this content whatever we want, but commonly we call this app.

8
00:00:46,430 --> 00:00:52,160
So the next thing is we need to do is actually listen for the request, which is listening for the iPod

9
00:00:52,320 --> 00:00:53,060
3000.

10
00:00:53,940 --> 00:01:03,390
And we need to do these things after listening to thousands, so we call cockatoos and here it automatically

11
00:01:03,570 --> 00:01:10,040
infer that we want to use a localhost so we do not need to at the localhost hear this.

12
00:01:10,050 --> 00:01:18,090
Also, we turned and in terms of server and just like this before, we also create a constant server

13
00:01:18,390 --> 00:01:23,340
in the server dodgiest so that we can also create this.

14
00:01:23,640 --> 00:01:25,870
But at a minute we do not need to do so.

15
00:01:25,890 --> 00:01:32,400
So we have set up the Express and we are now listening for the request at three thousand.

16
00:01:32,620 --> 00:01:35,370
But how do we respond to those requests?

17
00:01:35,610 --> 00:01:38,280
And actually this already has an example.

18
00:01:38,670 --> 00:01:42,150
So we copy and paste here.

19
00:01:43,470 --> 00:01:48,240
So if we want to listen to that request, we can use this app to get.

20
00:01:48,810 --> 00:01:53,100
And the first argument is the POF order, you know, you want to listen to.

21
00:01:53,760 --> 00:01:57,570
So if you want to listen to four words, you put the fourth last year.

22
00:01:57,840 --> 00:02:00,210
And the second argument is a function.

23
00:02:00,510 --> 00:02:08,450
And these functions text in a request and a response object so we can do something if those for the

24
00:02:08,490 --> 00:02:14,970
request object it contain the information about the request such as you are and also the method like

25
00:02:14,970 --> 00:02:21,430
cat pose or other the response object we can use to send a response like this.

26
00:02:21,930 --> 00:02:24,780
So first we had to start the app.

27
00:02:25,050 --> 00:02:30,300
So we use the app rather than not one server because we are going to run this file.

28
00:02:30,510 --> 00:02:34,400
So we go to localhost and we Dowton and Press enter.

29
00:02:34,830 --> 00:02:37,200
You can see how the world is to work.

30
00:02:37,400 --> 00:02:42,030
Instead of returning some task, we can also return the e-mail code.

31
00:02:42,600 --> 00:02:48,080
So we had a and then the time will come to the UK mobile.

32
00:02:49,680 --> 00:02:57,330
Now if we go to refresh the page, you infer the type of content that we are going to send to the browsers

33
00:02:57,510 --> 00:03:00,020
and it automatically set the content type.

34
00:03:00,750 --> 00:03:07,370
So we do not need to use the SAT had like this before and you can prove this by going to the network

35
00:03:07,380 --> 00:03:12,300
tab and click on the localhost and then you go to the content type.

36
00:03:12,870 --> 00:03:17,130
You can see it already set the content type as text or HTML.

37
00:03:17,460 --> 00:03:24,800
The other good thing is it also inferred the status that we do not need to manually set because a lot

38
00:03:24,840 --> 00:03:27,670
of the time we are going to set as two hundred.

39
00:03:28,170 --> 00:03:32,340
So when you go to here, you can see the status quo is two hundred.

40
00:03:32,820 --> 00:03:40,980
The request method is get and actually we can set the static manually, but at this point we will stay

41
00:03:40,980 --> 00:03:43,270
to use the state has two hundred.

42
00:03:43,290 --> 00:03:45,780
So we do not need to add the status quo here.
