Beautiful, and once we're done setting up register functionality before we do the same thing with a
log in one, I also want to install one more package and the package name is going to be Morgan, which
is a blogger middleware and why it's very useful.
Well, because as we start setting up more outs and controllers.
It's very cool to see what is the route that we're hearing, as well as the method and the status code.
Yeah, with just one register, I mean, we clearly kind of knew that.
But again, the more routes and controllers you have, it becomes very, very useful.
And pretty much Morgan has become a standard for that.
Now, if you want to find out more info, just please follow this link.
The setup is pretty typical.
Again, we go with AMPM I Morgan, so install the package version where you're required and then we
want to stick it in the middle where.
And we want to pass in one of the options, so timing is going to be probably one of the smallest ones,
basically you have the least amount of info.
And if you want to find out more options, you can pass in, just navigate to the docks and you'll be
able to find all of the info.
So let's keep on scrolling and notice here.
We're going to go with Dev because they will also add some colors here, and we'll be able to see the
method, the URL status.
And you can read the rest.
Now, one thing that will add here is the condition where I only want to do that if my note environment
is not equal to production.
And yes, once we push this up to production, once we host this on Roku, Heroku will set this node
on the score in V.
So note an environment equal to production.
And once they're in production, while there's really no need to log that correct.
So say, if note environment is not equal to production, yes, then I want to use abduct use used.
So that's my mentor.
And then I want to pass in the Morgan, which I just imported, and then I'm going to go with that option
because again, it just adds nice colors.
So let's start by setting up the install.
So I'm going to stop the server.
Clear everything.
And then let's go with npm install, OK, beautiful.
Then let's start the server right away because it will take a little bit of time and then back in the
server, just let's import the Morgan.
And I think I'm going to do that right after express async.
So important.
When Morgan from and of course, the Morgan one version, let's keep on going online.
I'm going to do that above express Jason where I'll set up my condition and I'll see if process that
interview again.
Narrowed Environment Variable, which is node, underscore the even if it's not equal to production,
it's not equal to production when awesome when we want to go with adult use.
That's the middleware online will pass in Morgan.
When I said in my case, the option I'm going to go with is Dev, let's save it and I'm going to swing
back to the postman and I'll set up similar questions.
So let's start with the register, but I'm looking for a 400 response because I'm going to try to register
with already existing email.
So at Senate, we get back 400.
But when I want to showcase is the fact that in my console, I'll see this one.
I'll say the method.
I'll see the path and also see the response.
And again, this is very useful as you start having more routes and controllers because by way, it's
much more easier to see what's happening.
It's very easy to make a small typo somewhere, let's say, on a front end or even in the postman where
you're hitting the route.
And actually, the method is incorrect like you just saw with the patch one where I was like, Hey,
listen, what's the problem?
And it's actually the method is very useful.
So let me also showcase that we have my home routes.
So if I'm going to go here to the postman and if I'll just set up a dummy route, for example, here
I have the URL.
If I send it, I'm going to get back on message API and again in my console also get.
So that means it's a Geraldton API version one and then response is 200.
And once we have the Morgan in place now, we can start setting up of the log in functionality.