In this video.
Let's see how we can solve the course error.
So now we are shifting from the client side to our server.
So now back to our Node.js server.
Let's go to the terminal and we are going to install a package called Cost.
So let's clear it.
And now and P and I and then the name of the package that is cost.
Now it's done.
Let's clear now and let's restart our server.
So here that is inside the server file.
So next is you are going to pass course as a middleware.
So make sure that you are the course before your route.
So here you're going to be course middleware, you make use of app dot use, and then you pass in the
course as a function.
Now we are done.
So let's get back to our client side and now let's try to log login again.
Let me clear the console here.
Now let me try again here st.
Now let's wait.
This time around we got the same access error, but lucky for us we have what is called the response.
Remember I pass in some wrong password here, so let's open the response.
And now on the response we have what is called data.
And this is a message from our back end with invalid login credentials and then start us called Field
and it's coming from our API.
If you go to the controllers and then the users and log in, which is this.
Remember we pass in the error as invalid login credentials and that is what we are receiving.
So now let's go ahead and log in with the right credentials.
So let me pass in the one, two, three, four, five and let me clear the console before I send.
Now you see, now you got something back which is beautiful than before.
So if I open it and now I'm a data, you can see we have the user a great.
So what we want is that we are going to save the entire user here into local storage.
So the same thing from the back end, if I go to the API and I click send, this is what you saw inside
the client side.
So now everything works fine.
Then this video, let's finish up with the reducer and then the action.