We've now finished up our first post service.
It's time to now test this thing out.
Now later on INSIDE the course we're going to eventually start to write some automated tests to make
sure that all of our services work as expected.
This is a really important aspect of micros services and we're going to go into great detail on it over
time.
But for this very first service we're gonna test it out manually to test out our service manually.
We're going to use a very simple API client.
So I'm going to go to post man dot com and find the postman API client Tester.
Now this is a very small desktop application that you can use to make arbitrary API requests to any
given endpoint.
We're going to use postmen to test out this personal service or to do that we put together just to save
ourselves a little bit of time.
If you do not want to download and install post van that's totally OK.
This step is really optional I just want to make sure that our services are working as expected to go
ahead and download the application.
If you have not already.
Once you download the app you can open it up and you'll see a window like this right here.
Inside of this window we're going to open up a new tab on the top left hand side and we'll customize
a request that we're going to issue to our post API.
I'm going to first get started by attempting to create a new post so I'll change the method.
Other requests we're going to make to post and I'll make a request to a local host offline 4000 slash
posts I'll then go to the headers Tab I'm going to specify a header here with a key of content dash
type I'll give that a value of application.
Jason and then of course we need to add in a body to the request and specify the title of the post we're
trying to make log over to the body Tab I'm going to select raw and I'll make sure that over here on
the right hand side at this dropdown is set to Jason.
We're then going to write out a little bit of Jason data to send to our API we'll put down a set of
curly braces.
I'm going to put in a key inside of double quotes because this is Jason we're writing right here not
javascript code.
I'll give it a title of first post like so once I've got that all put together.
I'll then send the request off and then down here at the bottom.
I should see a status and a response of to a one created and I should see the I.D. and title of the
post that we just made.
OK.
So it looks pretty good.
Now let's do another quick test.
We're going to make sure that we can retrieve all the posted have been created.
So I'm going to make a new tab inside of postman.
I'll make sure that I'm going to make a get request while entering a request you are out of look close
to 4000 such posts.
I'll go to headers I'll put in content type of application Jason and then in this case because we're
making a get request no body required.
Let's go ahead and send it right away.
And there we go.
So we can now see our posts coming back to us in the form of one big giant object.
Let's say this thing it looks like it's working correctly now as a quick reminder if we make any change
to our code inside of our project that's going to restart our server and because we are storing all
of our posts in memory all of our post will be automatically dumped.
If I go back over to my editor right now and I just add and say some comment right here and save the
file I've now restarted my server automatically because we're making is some node man.
So if I go back over to postman and make another get request I will no longer have any posts.
So just something to be aware of at some point time if you make any change you're going to start to
dump a lot of data OK.
So I'd say that our postal service is working correctly now we're not going to do a lot of testing like
this throughout the course.
Manual testing is what I mean we are can do a lot of testing automated testing.
So we're going to now take a break.
We're going to come back next video.
We're gonna start to put together our comment service.
Now I'm probably going to leave it to you to do a test with post man really quickly to make sure their
comment service works as expected as well.