Our common service is all complete.
So let's very quickly do a quick test using postmen.
I'm going to put that go in my terminal to get started.
I'm going to find my terminal window that is inside that comments project directory and I'll run NPM
start inside there.
Now once you recall that we now have two separate services two separate express applications running
on our machine.
One is listening on Port 4000 the others listening on port four thousand one.
So we want to communicate with our common service.
We need to make a request to local host or thousand and one all right.
So now that that is running let's flip over to postman.
I'm going to open up a new request tab right here.
I'm going to make a post request because I want to try to create a comment just to get started.
I'm gonna put in my local host four thousand and one again four thousand one because we want to reach
out to our comments.
Service and we'll make a request to slash posts.
The idea of a postal we want to add a comment to now our comment service right now it doesn't really
have any idea of what valid post ideas are so we can put in any post ideas right here that we want to.
Any string whatsoever.
I'm going to put in just one two three.
That's gonna be the idea of the post that we're going to imagine actually exists and then flash comments.
Next up I'll go to headers.
I'm gonna put in a content type of application slash Jason I'll then go to body I'll select raw I'm
going to make sure the dropdown is set to Jason and I will enter in some Jason right here remember a
comment must have a content property so I'll give my comments some content or something like I am a
comment I'll go ahead and send this thing off and there we go.
I've got a two a one created and you'll notice the inside of our response we've got an array of comments
that are associated presumably with post that has ideas One two three EPs that looks good now let's
make sure that we can retrieve all of our comments with some given post as well I can open up another
request Tab I'm gonna make a get request to a local host four thousand and one post and I want to get
all the comments that are associated with Post One two three flash comments then once again on the headers
tab content
of application Jason we don't need a body because we are making a get request so I'll go ahead and send
I get a two hundred OK and there is my array of comments right there just to make sure this is all working
correctly let's try to add in just one more comment make sure that we don't overwrite any comment or
anything like that so I got to go back over to my post request tab right here I'll change the content
to second comment I'll send it off I can now see inside the response and I've got two comments here
one that says I'm a comment dealer says second comment and then I go to my get request tab I can make
the request again and yeah there we go.
Very good.
All right.
So that is it for the very basic very simple express J.S. stuff that's all we're going to really write
as far as like simple express stuff goes we're not going to take a pause we're gonna come back the next
video and start working on that react application and once we finish that thing up very quickly we're
then going to start to see some really big issues start to crop up with our current design.
There is some really going to hit in nasty stuff inside of here.
Maybe it's not the worst stuff in the world but it's definitely not very efficient.
It's going to start to put that react application together.
We're gonna start to see some problems with our implementation and then we're gonna start to figure
out how we can solve these things with a micro services style approach.
So a quick pass see you in just a minute.