All right, so now we're going to look at Postman and just get that set up so we can make Http requests
to our back end API.
But I just want to mention something first.
If you run your servers with NPM run dev, you're going to see the home screen looks fine.
Everything is here.
We have our products being fetched right now.
They're being fetched from this data products.
JS Because we haven't integrated the database with our front end yet or our back end, we've just basically
created it and added data to it.
Now if you go to one of the single product pages, it's not going to work because we don't have an ID.
You can see right here, this is undefined because it's looking for the underscore ID field in the products
file.
So that's absolutely fine.
I just didn't want you to get worried that something was broken.
We just haven't gotten there yet.
All right.
Now, as far as Postman goes, this is a really, really great Http client.
It's completely free.
Well, I guess there are pricing options, but you can do pretty much everything for free or everything
we're going to need.
So there's a browser version and you can also download it.
I would suggest downloading and installing it.
That's what I've always done.
So I'm going to open up the desktop app and you can certainly just, you know, create request tabs
and just make make requests all willy nilly.
But I like to categorize everything and save all my requests and have a workspace and have an environment.
So I'm going to show you how to set all that up.
So first thing we're going to do is create a new workspace.
So right here we say create workspace.
I'm going to call this pro shop and I'll just call it pro Shop V two, you can call it whatever.
And I'm going to select personal just because I'm the only one that's going to access this.
I think the paid options are more for if you're collaborating with a team.
But let's click Create, and then I'm going to let's see, I want to create an environment because an
environment allows us to have environment variables within postman such as our URL.
So our URL would change once we go into production and we have a domain name and instead of changing
it in every single request, you can just change the variable.
So let's say create environment and we can name it.
So I'm going to call this pro shop.
Pro Shop v two.
Environment.
Actually, I'll just say pro shop environment.
All right.
And then here is where we can add variables.
So the variable I want to add, I'm going to call base URL.
And what I want that to be is our API.
So Http and localhost port 5000.
And I'm also going to add on slash API because all of our routes have that.
So that way we don't have to type it out.
We can just say base URL slash products, users, whatever, and then it'll also get added to the current
value.
So make sure you save.
It's easy to miss this, but the save button is right here.
Let's click that.
Now up here in the dropdown, we can say that we want to use our pro shop environment.
Okay, so the next thing we want to do is go to API's and create an API, say Pro shop API.
Create actually version.
I'm going to say 2.00.
And now we'll create an API.
Now when we want to make a request, I want them to be in in a collection.
So we're going to have basically three collections, products, orders and users.
So we're starting with products.
So let's create a collection.
I'm going to call it products.
Okay.
And then.
Yeah, that should do it.
So in products I'm going to have and you can create subfolders if you want, but this is where we want
to add all of our requests.
So let's click add requests and we can name it.
So let's say get all.
Products and then the URL.
So to use your variable, you just use double curly braces.
If we start to type base, you'll see the option base URL.
So we're going to use that and then just say slash products.
Okay.
And if I click send, it's going to go ahead and show me the products.
There's no ID because remember, we're still fetching from the file, not the database, but this is
going to stay the same regardless.
So what I'm going to do is click save.
That way, whenever we need to fetch products, we can just simply come over here into our collections
and select get all products.
Okay, we can close the rest of this stuff up so that at least gets us set up.
I like to have everything organized, so as we create routes in our API and test them, we'll save them
to Postman as well.
Okay.
So now in the next video, we're going to start on actually fetching our products from the database,
from our Express API.
We're going to do that before we get into like Redux and get back into our front end.