1
00:00:05,580 --> 00:00:06,810
Welcome back.

2
00:00:06,840 --> 00:00:12,090
In this video, let's see how we can make use of third party middleware.

3
00:00:12,270 --> 00:00:16,770
And the third party middleware that we are going to use is called MORGANE.

4
00:00:16,770 --> 00:00:21,240
So if you search for Morgan NPM, we're going to take you to this page.

5
00:00:21,240 --> 00:00:25,560
Or you can search for Morgan Inside NPM registry.

6
00:00:25,560 --> 00:00:28,380
And this is a package that we are going to use.

7
00:00:28,650 --> 00:00:36,000
So this package is all about a logger, meaning it's going to log the request to the console, as we

8
00:00:36,000 --> 00:00:40,380
did in the previous video, shut down and then let's click the console.

9
00:00:40,620 --> 00:00:47,820
If you want to install this package as dev dependencies, these are going to be I'm going to give it

10
00:00:47,820 --> 00:00:52,110
a flag dash dx, which means def dependency.

11
00:00:52,230 --> 00:00:59,100
So our hits enter and now it is installing because I need this package only in a development environment

12
00:00:59,100 --> 00:01:01,530
in production, I don't want to see the logger.

13
00:01:01,530 --> 00:01:07,920
So now let me start my server and now I'm back to Visual Studio code, which is this let me check my

14
00:01:07,920 --> 00:01:14,610
package, the JSON file and I have the package Morgan being installed as Todd.

15
00:01:14,610 --> 00:01:16,620
So how can we use it?

16
00:01:16,770 --> 00:01:25,950
The first step is we require the package console, which is Morgan and equal to required the package

17
00:01:25,950 --> 00:01:27,780
which is Morgan.

18
00:01:28,350 --> 00:01:31,110
So next step is how can we use it?

19
00:01:31,140 --> 00:01:32,400
It's pretty simple.

20
00:01:32,430 --> 00:01:34,680
It's pretty simple and it's pretty simple.

21
00:01:34,680 --> 00:01:35,790
So here we go.

22
00:01:35,970 --> 00:01:37,860
So use Morgan.

23
00:01:37,860 --> 00:01:39,900
Mature use Morgan.

24
00:01:41,720 --> 00:01:42,320
Your.

25
00:01:43,510 --> 00:01:44,470
Where so now?

26
00:01:44,500 --> 00:01:45,490
Down here.

27
00:01:45,520 --> 00:01:54,040
As always, make use of app dot use and then bring in Morgan and here it has in one agreement with these

28
00:01:54,040 --> 00:01:54,730
options.

29
00:01:54,730 --> 00:01:57,550
So all these are from where from the documentation.

30
00:01:57,550 --> 00:02:03,850
So if you make use of combined, it means that you're going to see more details about the request object.

31
00:02:03,850 --> 00:02:10,660
So now this one, if I go to post mine and I hit send inside the terminal, if you see that, I see

32
00:02:10,660 --> 00:02:18,340
the request object and that is it is because of the package and has given me the date and time.

33
00:02:18,340 --> 00:02:25,240
I used to make the request and then the HTTP method and then the route where I hit.

34
00:02:25,270 --> 00:02:29,320
Okay, that is a post slash one which is for delete.

35
00:02:29,530 --> 00:02:35,530
But if you don't want to see more details about this, but we want the request only we are going to

36
00:02:35,530 --> 00:02:40,390
provide different given to this one as def.

37
00:02:40,570 --> 00:02:47,650
So if I save it now, if I hit this endpoint now this what I get with few details, it gives me the

38
00:02:47,650 --> 00:02:52,090
HTTP method and then the route in the next video.

39
00:02:52,090 --> 00:02:54,460
Let's get started with our coding challenge.

