1 00:00:01,030 --> 00:00:04,600 Now that we've got a better idea of what all of our different action functions are going to do let's 2 00:00:04,600 --> 00:00:08,940 make sure that we install axioms and set it up so we can make a request to our API. 3 00:00:09,220 --> 00:00:12,240 So I gonna flip back over my terminal inside my project directory. 4 00:00:12,280 --> 00:00:18,930 I'll do an npm install axioms like so while that's running I'll flip back over inside of my SDR see 5 00:00:18,940 --> 00:00:19,460 directory. 6 00:00:19,480 --> 00:00:25,240 I'm gonna make a new folder called API and then inside there I'm gonna make a new file to create and 7 00:00:25,240 --> 00:00:31,330 configure an instance of axioms I'm going to call this simply tracker dot J.S. since we're accessing 8 00:00:31,360 --> 00:00:36,140 our tracker API then inside of here we're going to import ASIO's 9 00:00:39,250 --> 00:00:41,410 will then create an instance and export it. 10 00:00:41,460 --> 00:00:47,730 So I'll say export default axiom stock create it for right now the only real configuration option we 11 00:00:47,730 --> 00:00:50,560 want to put inside of here is our base U.R.L.. 12 00:00:50,700 --> 00:00:53,700 Remember your El right here is all capitals. 13 00:00:53,700 --> 00:00:55,840 So what are we going to put in for the base your El. 14 00:00:56,040 --> 00:01:01,170 Well cricket minor if you're running on a physical device in other words if you are testing your React 15 00:01:01,170 --> 00:01:06,270 Native application on a physical device it is entirely possible that it might be running on a separate 16 00:01:06,270 --> 00:01:12,090 network and if your device is running on a different network than your actual computer where the Express 17 00:01:12,090 --> 00:01:17,920 API is your phone is not going to be able to very easily access that express API. 18 00:01:18,090 --> 00:01:22,920 If your phone and your computer are on the same network it is possible to get your phone to access the 19 00:01:22,920 --> 00:01:23,400 API. 20 00:01:23,580 --> 00:01:27,990 But honestly I read lots of issues come up during that process. 21 00:01:28,080 --> 00:01:34,260 You might be using a router or some network control you might be on a company Wi-Fi network or a public 22 00:01:34,260 --> 00:01:38,800 Wi-Fi network that will not allow your phone to get direct access to the Express API. 23 00:01:39,060 --> 00:01:44,880 So to solve all these possible issues we're just going to use that and grok tool once again remember 24 00:01:45,000 --> 00:01:50,730 and grok is going to essentially open up a direct connection from your express API and give you a public 25 00:01:50,730 --> 00:01:53,310 you URL that you can have your phone look at. 26 00:01:53,310 --> 00:01:55,550 To get access to the API now. 27 00:01:55,560 --> 00:02:01,560 Quick reminder here as soon as we start using any drug you have to use and grok at all times for the 28 00:02:01,560 --> 00:02:06,150 rest of this application because it's the only way that your phone is going to build to contact the 29 00:02:06,150 --> 00:02:09,480 Express server so that base your old property. 30 00:02:09,480 --> 00:02:15,290 We're gonna put in whatever you are L and grok gives us to get access to the Express API. 31 00:02:15,300 --> 00:02:20,750 Now remember if we are making use of and grok without paying any money so for using it freely. 32 00:02:20,920 --> 00:02:24,490 The URL that we get is going to expire after 8 hours. 33 00:02:24,720 --> 00:02:30,120 So that means that for the rest of this application if you take longer than 8 hours from like right 34 00:02:30,120 --> 00:02:35,730 now to finish up the rest of this application at some point in time the end grok connection is going 35 00:02:35,730 --> 00:02:41,400 to fail and you're going to have to restart and grok it's going to give you a new york URL and we're 36 00:02:41,400 --> 00:02:45,230 going to use that as the new base you l with axioms. 37 00:02:45,420 --> 00:02:48,390 So this line right here this applies to you 100 hundred percent. 38 00:02:48,390 --> 00:02:53,280 You gotta remember after 8 hours eventually all your network requests from your device are going to 39 00:02:53,280 --> 00:02:58,740 start to fail and to solve that you're gonna restart and grok take that new year out that you get and 40 00:02:58,740 --> 00:03:02,170 throw it in right there with axioms. 41 00:03:02,240 --> 00:03:08,090 So then mind I'm gonna flip back over to my terminal looks like Acciona is all done being installed 42 00:03:08,470 --> 00:03:11,760 so going to very quickly make sure that I've got in Greek installed as well. 43 00:03:11,900 --> 00:03:14,170 Remember we installed it globally just a little bit ago. 44 00:03:14,180 --> 00:03:19,050 So just do a quick and grok like so and you should see a help message appear. 45 00:03:19,190 --> 00:03:24,590 If you don't see that help message you can reinstall and grok with the NPM install dash G integral like 46 00:03:24,590 --> 00:03:31,020 so OK so once we've got that up I'm going to make sure that I set up and grok and tell it to look at 47 00:03:31,020 --> 00:03:35,770 my express API which I still have running inside of a different terminal window. 48 00:03:35,820 --> 00:03:40,370 EXPRESS API is running on port three thousand unless you had to change it for some reason. 49 00:03:40,410 --> 00:03:46,970 So now I've got one terminal window for my express API one for my react native bundler and now I'm going 50 00:03:46,970 --> 00:03:50,500 to have a third terminal window for running and grok as well. 51 00:03:50,910 --> 00:03:57,360 So inside this third window I'll do and grok H TTP and then the port that we want to expose on our local 52 00:03:57,360 --> 00:03:57,920 computer. 53 00:03:57,930 --> 00:04:03,330 In this case 3000 so once we run that we'll see that we now have eight hours left. 54 00:04:03,340 --> 00:04:05,190 So there's the timer in eight hours. 55 00:04:05,200 --> 00:04:11,360 This is going to expire and we need to update our bases where l it's now on this UI. 56 00:04:11,390 --> 00:04:13,100 We have forwarding right here. 57 00:04:13,100 --> 00:04:19,190 That right there is the address that will take us to local host three thousand so I'm going to copy 58 00:04:19,190 --> 00:04:24,400 that and put it in here as my base you are El. 59 00:04:24,560 --> 00:04:29,570 In addition just to make sure that you are L is working as expected we can very quickly try to access 60 00:04:29,570 --> 00:04:31,200 it inside of our browser. 61 00:04:31,220 --> 00:04:37,310 Remember right now our Express API if you went through all that setup let me pull open my code editor 62 00:04:37,310 --> 00:04:38,300 for The Express API. 63 00:04:38,300 --> 00:04:39,500 Here we go. 64 00:04:39,500 --> 00:04:41,030 So we've got our Express API. 65 00:04:41,030 --> 00:04:46,100 Remember we've got a default root root right here that's going to require you are user to be signed 66 00:04:46,100 --> 00:04:47,120 in to view it. 67 00:04:47,120 --> 00:04:51,170 So if we want to just make sure that grok is working correctly at any point in time we can navigate 68 00:04:51,170 --> 00:04:55,250 directly to that you were all inside of our browser and we'll see something like You must be logged 69 00:04:55,250 --> 00:05:00,110 in because once again in order to access that root root remember we had put in that middleware inside 70 00:05:00,110 --> 00:05:00,860 there. 71 00:05:00,860 --> 00:05:05,620 So at any point if you feel like and grok is not working correctly you can always paste that you URL 72 00:05:05,660 --> 00:05:10,280 that you get from the terminal inside your browser try to access it and you should see a message like 73 00:05:10,280 --> 00:05:16,280 that appear OK so now we've got this all put together once again just wanna remind you this is going 74 00:05:16,280 --> 00:05:21,530 to apply to you in eight hours restart and grok through the New Year URL inside there. 75 00:05:21,580 --> 00:05:21,800 OK. 76 00:05:21,800 --> 00:05:23,480 Now we've got everything all set up. 77 00:05:23,480 --> 00:05:24,820 Let's take a quick pause right here. 78 00:05:24,830 --> 00:05:29,750 When come back the next video we're gonna take this Acciona instance and use it inside of our off context.