So we have this middleware to protect access to certain routes on the back end, let's try to make sure
it works so I'm in my roots dash API, go for it and I'll just put a test route in here.
I could get route so we can get to it from a web browser and want to put test.
Now, when I put test here, whatever's up here on Muxtape Route is prepend into this route.
So the route we're going to be going to is localhost port four thousand and one in our case, API slash
admin and then slash test and I'll just write a simple funkier inline function which takes W which is
an active response rider because this needs to be a handler and a pointer to a request.
And all I'll do is if we're able to access this route, I'll just write, I'll call W right and give
it a slice of bytes which is the string got in and because we're going to be hitting this from a web
browser.
This should never execute.
Instead we should get a JSON response.
So let's give this a try.
Open my terminal here.
The screen make start.
Just to make sure everything is compiled in the latest version, then I'll go to my Web browser and
in here I'll open a new tab and I will go to HDB Coingate localhost and we're hitting the back end API.
So it's port four thousand and one API admin test.
And if everything works as expected because we're not sending an authorization header with with this
request, we should get an error adjacent file that says there's been an error with some kind of message.
Let's see what happens.
And it says error is true, message is invalid authentication credential credentials, which is exactly
what I expected to see.
So it works really well.
So the next step is to go back to virtual terminal.
And right now when we submit when we charge a credit card, it calls stripe charges.
The credit card sends back a response that says, yes, everything was successful.
And then we actually submit this form to the front end.
So we're going to change that and instead make virtual terminal call a route on the back end.
And that's not very difficult.
And we'll get started on it in the next lecture.