Welcome back.
In this video, let's see how we can make use of third party middleware.
And the third party middleware that we are going to use is called MORGANE.
So if you search for Morgan NPM, we're going to take you to this page.
Or you can search for Morgan Inside NPM registry.
And this is a package that we are going to use.
So this package is all about a logger, meaning it's going to log the request to the console, as we
did in the previous video, shut down and then let's click the console.
If you want to install this package as dev dependencies, these are going to be I'm going to give it
a flag dash dx, which means def dependency.
So our hits enter and now it is installing because I need this package only in a development environment
in production, I don't want to see the logger.
So now let me start my server and now I'm back to Visual Studio code, which is this let me check my
package, the JSON file and I have the package Morgan being installed as Todd.
So how can we use it?
The first step is we require the package console, which is Morgan and equal to required the package
which is Morgan.
So next step is how can we use it?
It's pretty simple.
It's pretty simple and it's pretty simple.
So here we go.
So use Morgan.
Mature use Morgan.
Your.
Where so now?
Down here.
As always, make use of app dot use and then bring in Morgan and here it has in one agreement with these
options.
So all these are from where from the documentation.
So if you make use of combined, it means that you're going to see more details about the request object.
So now this one, if I go to post mine and I hit send inside the terminal, if you see that, I see
the request object and that is it is because of the package and has given me the date and time.
I used to make the request and then the HTTP method and then the route where I hit.
Okay, that is a post slash one which is for delete.
But if you don't want to see more details about this, but we want the request only we are going to
provide different given to this one as def.
So if I save it now, if I hit this endpoint now this what I get with few details, it gives me the
HTTP method and then the route in the next video.
Let's get started with our coding challenge.