In this video, we are going to create a controller to fetch a single post.
So let's get back to the controllers and post and then post controller.
Let's collapse this one.
And this is the end point for finding a single post, which is this post details or fetch posts and
we can have the idea of the post in the params.
So first step is that get the id from params and going to be as const id is equal to rec dot params.
Deutsch ID and let's go ahead and find the pores in our DB.
So find the post I'm going to be as concerned.
Post is equal to weight post model dot find by ID and the ID is from the PARAM, which is this.
And lastly, let's send the response back to the user as post.
And the variable here is going to be data and let's throw an error in case we have one.
So I'll pass in next here.
And then inside the cache block, I'm going to call next and pass in the app error and the message can
be found on error message and that is it.
So let's get back to the request handler here, and that is for the 10th client.
And let me click on details and let's find the ID of the post.
So let's get back to our DB.
Let me connect and inside the full stack block database post and we have three posts for me, so let
me choose the ID of this one and here I'll provide the ID as that and let me make the request.
And we have the single post and that is it.
The next video.
Let's fetch our post.