We're not ready to start development of our art service.
Now remember a couple of videos ago I told you that we're going to take a very testing heavy approach
in the development of this application before we worry about sending up any additional tooling around
testing or anything like that.
However I think that we should just make sure that we can do some manual testing using something like
say postman just we can get started with this authentication stuff and continue making some progress
forward.
So in this video we're going to set up a root handler or the root of API users current user whenever
we make a GET request to that.
Right now we'll just send back some dummy response to maybe some little message like hi there or something
like that.
Well then make sure that we can access that inside of our browser.
So let's get to it.
I'm going to first get started by going to my auth directory.
Inside there off on the SRT folder and then the index dot yes file inside of their than inside they're
going to add in a get request handler.
They'll do it an app dot get we want to listen for an incoming request on the route of API users current
user the API users current user and I'll add in my callback with req and rez like so
then inside of here we're gonna take that response and we'll send back something like buy there for
right now I'll then save this file I should then be able to go back over to my terminal and confirm
that my server has automatically restarted.
OK.
So Alex Good.
Now we need to be able to somehow access are running server specifically our off pod remember that to
access anything inside of our cluster.
We have to set up one of two things really have two options.
We can either set up on those node port services or we can setup that ingress service.
Remember that Ingress is all about having some routing rules tied to engine x.
So in any time a request comes into our cluster it'll be handled by that ingress service.
They'll be routed off to the appropriate service within our cluster.
So that's what we're going to do right now.
We're going to add in a little bit of configuration rules to ingress engine X just as we did on our
last application now.
Quick reminder about ingress engine X in general between the last application and this one we did not
delete ingress engine X or anything like that out of our cluster when we stopped our scaffold tool from
the last application.
Just a couple of videos ago we deleted all the deployments services and pods that were listed inside
of our project.
From that last project we did not delete anything specifically tied to ingress engine X beyond our set
of config rules.
So in other words you should not have to reinstall ingress engine X right now unless you for some reason
reset your cluster between the last set application and this one or manually deleted all the ingress
engine X stuff or something like that.
So we should only have to write out a new config file for ingress engine X and that config file will
be loaded into our existing copy of the ingress engine next controller.
That is all running or still running I should say inside of our cluster.
As a quick reminder if you did restart your cluster or reset it right thing like that for any reason
to get ingress and Gen-X reinstalled all you Chef do is come to the documentation page go to deployment
run the mandatory command right here and then run either the docker from Mac.
This is also the docker for Windows option or the mini can keep command right there OK.
So once you get that stuff all set up we're going to put together a ingress config file once again and
we're going to make sure that any time a request comes in for a request to our route of API slash users
we're going to send it off to our art service.
So let's do that right away back inside of my editor.
I'm going to find my infra directory inside the K AIDS folder inside there.
I'm going to create a new file called Ingress dash SRB thought Amel that inside of here we're going
to write some configuration to tell the ingress engine X controller exactly how to handle incoming requests
let's say API version extensions slash V1 Beta 1 bind of ingress metadata we're going to give it a name
of ingress dash service we're gonna put on an annotation section the first annotation we'll add in is
Cuba net is dot Io.
Double check your spelling on Cuban net right there.
Very easy word to Miss type flash ingress thought class is engine X and then engine X that ingress dot
Cuba net is that Io slash use rig x of true.
And remember trainees to be inside of quotes like so don't forget that this overall annotation right
here is telling.
Engine next that it should expect that some are different path that we're gonna list in the bottom half
the file are going to have regular expressions inside them well then put together our spec section we're
going to have a set of rules just one road or right now.
So I'll put in a dash number we'll specify our host.
Remember that the host right here is going to be a kind of pretend domain name.
So we're gonna put in some made up domain name right there.
There were going to be able to connect to only from our local machine.
So whatever domain name that we're gonna enter in right there we're gonna make sure we also go over
and edit our Hosts file as well just as we did on the last project.
I'm going to use a made up domain name of tickets not death.
And how about I'll do ticketing dot Dev.
So this is my made up domain name that is only gonna work on my local machine I'll then put in an H
TTP section with parts.
We're gonna have one entry inside of here right now so gonna give it a path of slash API flash users
slash question mark parentheses dot star that means that any time someone makes a request to our cluster
and the request has a path of API slash users slash anything then we're going to send that request on
to this listed back end in this case we want to send it to the service that has a name of off Dash.
S are V.
Remember that name is coming right there from the auth service we created just a moment ago inside of
our opt depot file there's the name of the service that we want to send the request to and we want to
make sure that we send it to the service on the port three thousand we'll do that service name along
with a service port of three thousand as well and I'll save this file once I save the file I should
be able to go back over to my terminal and see that the ingress service was configured so that looks
good let's take a quick pause right here.
When we come back the next video we still have to do a little bit of setup so remember we have to update
our host file on our local machine to make sure that any time we make a request to ticketing dot Dev
it redirects that request to our local machine or it stays on our local machine.
So we'll take care of that in just a moment.