In order to start working with products in our application we're going to have to perform a CTP request
and for that we're going to need to install axioms which by the way is already installed.
I'm just going to go over the command line.
We're gonna need to get the URL so where we have temporary product.
And then lastly we're just going to take a look at our response must start by installing the exhales.
So I'm going to stop there sir.
Again you already have axes installed if you're using the Star project.
I'm just gonna go over the command where I'm going to clear the console online ordering right NPM I
and we have Pax CEOs and then we can add dash dash save.
So that's going to install the initially TPL library that allows us to make a request.
You could technically use fetch.
The reason why I'm using axe here is because strappy the back end that we're gonna use in order to create
our own API uses it in their documentation.
So it's just gonna be less confusing for you just in case there are some errors.
And I'm going to clear again everything in the console and before I start up the server I'm gonna get
my new URL.
Now the fastest way of getting the URL is by navigating through John Smith of the dot com.
So dub dub dub John Small the dot com.
Then go pass courses and then look for redirect text store version.
And then look for the API so click on the API and you're gonna have John's small tutorials and forward
slash and wherever you are Alice and I know that you're thinking Okay wait a minute why you're giving
us the URL if I can clearly see that.
Well we cannot get anything from that.
Your URL and I'm going to show you in a second why we're doing that.
And the simple answer is because that's how again the response comes back from stripping.
So just copy and paste the URL like so that over back to the you are well within the utilize and just
export it as a default.
So right.
Export default and then passing the string so set up the string and then passing the URL don't add the
forward slash make sure that you just copy and paste it the way it is.
OK.
So once we set this up the product the actual response is gonna be on a forward slash products.
And again the reason why we're doing that is because that's how strappy sends back the response.
So once you in fact change it to your own API that we're going to create later on.
Again you don't have to refactor your whole application because when we're gonna be setting up our own
a sheet requests we're going to say we would want to get data from forward slash products.
So if let's say we're going to say right now and if we're going to navigate back to the URL that I provided.
If you're going to type in forward slash and then products then we're going to get back to products
and products is just gonna be a giant array meaning giant 7.
So I don't know some people that might be big.
So for some it might be small but we're going to have seven products and each and every product is going
to have a title as well as the idea price description some properties that strappy just adds by default.
So it's not like we're going to use them and it's not like we are going to create them but strappy just
as them.
So since I wanted to have exact same response as you're going to have from your local project and that's
the reason why you have these properties and then you have a giant image again not something that I
created myself but that's how strappy returns the images and the property we're going to be looking
for is the URL.
So we're going to loop over disarray and then we're going to access specific data about our product
and if we're going to head over back to our U RL file we did install the axe heroes we got the URL and
finally we looked at our response.
So once I do that I can just clear again the console and then we can type NPM start to start up our
dev server.