WEBVTT 00:02.060 --> 00:07.400 So we have this middleware to protect access to certain routes on the back end, let's try to make sure 00:07.400 --> 00:13.970 it works so I'm in my roots dash API, go for it and I'll just put a test route in here. 00:14.390 --> 00:18.760 I could get route so we can get to it from a web browser and want to put test. 00:18.800 --> 00:25.630 Now, when I put test here, whatever's up here on Muxtape Route is prepend into this route. 00:25.640 --> 00:32.400 So the route we're going to be going to is localhost port four thousand and one in our case, API slash 00:32.570 --> 00:40.700 admin and then slash test and I'll just write a simple funkier inline function which takes W which is 00:40.700 --> 00:45.410 an active response rider because this needs to be a handler and a pointer to a request. 00:48.860 --> 00:56.300 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 00:56.300 --> 01:03.620 it a slice of bytes which is the string got in and because we're going to be hitting this from a web 01:03.620 --> 01:04.050 browser. 01:04.280 --> 01:05.460 This should never execute. 01:05.480 --> 01:07.610 Instead we should get a JSON response. 01:07.610 --> 01:08.590 So let's give this a try. 01:09.230 --> 01:10.790 Open my terminal here. 01:10.790 --> 01:12.800 The screen make start. 01:14.310 --> 01:19.710 Just to make sure everything is compiled in the latest version, then I'll go to my Web browser and 01:19.710 --> 01:27.840 in here I'll open a new tab and I will go to HDB Coingate localhost and we're hitting the back end API. 01:27.840 --> 01:35.370 So it's port four thousand and one API admin test. 01:35.820 --> 01:40.410 And if everything works as expected because we're not sending an authorization header with with this 01:40.410 --> 01:46.110 request, we should get an error adjacent file that says there's been an error with some kind of message. 01:46.140 --> 01:46.910 Let's see what happens. 01:48.110 --> 01:54.560 And it says error is true, message is invalid authentication credential credentials, which is exactly 01:54.560 --> 01:56.010 what I expected to see. 01:56.240 --> 01:57.290 So it works really well. 01:58.040 --> 02:00.860 So the next step is to go back to virtual terminal. 02:01.280 --> 02:07.790 And right now when we submit when we charge a credit card, it calls stripe charges. 02:07.790 --> 02:11.660 The credit card sends back a response that says, yes, everything was successful. 02:11.660 --> 02:14.200 And then we actually submit this form to the front end. 02:14.870 --> 02:20.300 So we're going to change that and instead make virtual terminal call a route on the back end. 02:20.360 --> 02:21.590 And that's not very difficult. 02:21.590 --> 02:23.750 And we'll get started on it in the next lecture.