We can now read into email and password that a user enters into this form when they submit it.
So now we need to take that email and password and reach out to our all service and attempt to sign
up for a new account.
So how are we going to do that.
Well remember we've already discussed this at great length.
When we were initially putting together our off service the all service has a POST request handler watching
for incoming requests on API users sign up.
So all we have to do from our ReACT application running inside the browser is make a POST request to
API users sign up.
That's gonna go off shore of service.
Now the reason I'm kind of making a big deal around this is remember we actually have multiple layers
of things between the browser and the author service.
We've got the ingress engine ex service which is going to handle some initial routing whenever ingress
engine ex routes request it goes off to a cluster IP service running inside of our cluster and from
the cluster IP service then the thing finally gets sent off to the pod that is running our off container
and then inside that container is the express application that's going to route the request to a request
handler where we actually create our user.
So even though this diagram looks really simple remember there are many things running between our actual
off container Andy browser.
So all that mind again all we really do here is make an ajax request to our order service specifically
of that route right there to make the request itself.
We're going to use the Axis library.
We need to install access.
So I going to flip back over to my terminal and again inside my client directory I will run an npm install
axioms now just like bootstrap whenever we install something or make a change that package not just
on file scaffold needs to rebuild the image and then deploy it into our cluster.
So after running this command you're going to want to go back over to the window running scaffold and
make sure that you wait for the installation to be completed.
So you're gonna see something like this right here all that gibberish.
So there's my npm install the image was rebuilt and then eventually updated inside the cluster and I
could see right there is where the pod got restarted with a new version of that image.
The image that has axial is installed to make sure you wait for that installation process to be completed
once it's done we can then go into our Ed and start to write out some code inside of here to make use
of axes.
So at the very top we will first import access from axioms
all then find the on submit I'm going to delete the console log and replace it with a weight axles that
post to API users sign up and I'll pass along the email and password as the second argument let's then
take the response coming back from this
and right now I'll do a console log of response that data just you know whenever axles gets a response
from some requests the actual response data is available on response dot data is going to make sure
that we get back something that looks like a user something that describes we just signed in as well
then save this I'm going to flip back over to my browser and again if you did not wait for everything
to be restarted then you're going to get an error when you run this code or more relevant when we even
try to refresh our code because I tried to use the awake keyword right here without marking the enclosing
function as async.
That's better.
Now the error went away.
So again if you tried to submit this form now and you get an error about Acciona being undefined or
something like that you need to make sure that you wait for axioms to be installed.
Well then go ahead and enter in an email address right here.
So do you test 20 at test dot com and a password or then hit sign up and there's the response right
there.
So I've gotten email and the I.D. of the user that I just signed up as.
And in theory I now have a cookie tied as well that identifies me to the back end server.
If I go over to network and find X H.R. right here I can then click on sign up take a look at the headers
tab and if I find it response headers I should see inside of here a set cookie.
There it is right there.
So remember the set cookie header is what sets a cookie.
My browser is going to intercept this header and automatically manage that data.
Now any time I make a followup request to the back end server this cookie it will be automatically included
with the request.
And remember is a mechanism that identifies us.
Well I'd say this is a good success.
However do remember that we put in some actual validation for this thing as well.
We said that email must look like an email right now.
If I change the email input to an invalid e-mail and then tried to submit I definitely get an error
so there's the air request right there.
If I take a look at the response there is our standard error formatting but we are not actually showing
this information anywhere on the screen so this definitely looks good but we still got a little bit
of work to do.
Let's take a quick pause and then add in some of this actual validation handling in the next video.