1 00:00:00,410 --> 00:00:03,305 Okay, so we're in a pretty good place with our service on Bluemix. 2 00:00:03,305 --> 00:00:06,759 We've created it successfully, and even though it's not doing anything we have it, 3 00:00:06,759 --> 00:00:07,954 and we have our credentials. 4 00:00:07,954 --> 00:00:11,806 And that's important because next I want to get our local project set up. 5 00:00:11,806 --> 00:00:15,946 And I wanna use those credentials, plug them in where they need to go here, and 6 00:00:15,946 --> 00:00:19,589 make sure that our local app is communicating successfully with that 7 00:00:19,589 --> 00:00:20,616 service we set up. 8 00:00:20,616 --> 00:00:25,026 Even though it won't do anything It'll be a nice proof of concept that everything is 9 00:00:25,026 --> 00:00:26,961 hooked together like it needs to be. 10 00:00:26,961 --> 00:00:30,547 So if you've downloaded your starter files, unzipped them like this, and 11 00:00:30,547 --> 00:00:32,575 opened them in your favorite text editor. 12 00:00:32,575 --> 00:00:37,505 I'm gonna drag them over here and close this Welcome window. 13 00:00:37,505 --> 00:00:40,350 And we'll review these files in the project in a little while. 14 00:00:40,350 --> 00:00:43,763 But let's open up the .env file. 15 00:00:43,763 --> 00:00:47,225 So, the first thing we're going to do is connect this code to our new service. 16 00:00:47,225 --> 00:00:51,729 We do this by adding the unique ID from the workspace and the username and 17 00:00:51,729 --> 00:00:53,541 password that we looked at. 18 00:00:53,541 --> 00:00:55,204 All right, so we need the workspace ID. 19 00:00:55,204 --> 00:00:57,077 Arman, where should I go to get that? 20 00:00:57,077 --> 00:00:58,454 >> Absolutely right, Ben. 21 00:00:58,454 --> 00:01:00,838 It is time to grab the workspace ID. 22 00:01:00,838 --> 00:01:04,128 If you note on your left hand panel, 23 00:01:04,128 --> 00:01:08,740 that very link to the bottom is back to workspace. 24 00:01:08,740 --> 00:01:12,533 Perfect, and we're seeing our own Treehouse chatbot. 25 00:01:12,533 --> 00:01:17,401 Let's click those three action items, and click View details. 26 00:01:17,401 --> 00:01:18,097 >> There it is. 27 00:01:18,097 --> 00:01:18,725 >> There it is. 28 00:01:18,725 --> 00:01:21,441 >> And you've created a copy link right there, great. 29 00:01:21,441 --> 00:01:23,218 >> Absolutely. 30 00:01:23,218 --> 00:01:26,380 >> And now back here where we have Add your workspace ID, 31 00:01:26,380 --> 00:01:28,146 I'm going to paste in the ID. 32 00:01:28,146 --> 00:01:32,082 And next we need to go back and get the conversation username and password. 33 00:01:32,082 --> 00:01:36,844 >> Absolutely, for that, Ben, we will go back to the Bluemix login page, 34 00:01:36,844 --> 00:01:38,965 not the conversation service. 35 00:01:38,965 --> 00:01:40,695 >> Okay, so I'm gonna click over here. 36 00:01:40,695 --> 00:01:42,784 >> And we will click service credentials- >> There we go. 37 00:01:42,784 --> 00:01:46,233 >> For the conversation service build >> And we already have it open. 38 00:01:46,233 --> 00:01:47,103 >> And there they are. 39 00:01:47,103 --> 00:01:51,016 We will copy the innards and bits within the double quotations. 40 00:01:51,016 --> 00:01:53,624 >> Cool, I'm going to copy both and clean up any other file. 41 00:01:53,624 --> 00:01:55,532 And this URL is the same thing? 42 00:01:55,532 --> 00:01:58,040 >> Correct. >> Then we see over here, right. 43 00:01:58,040 --> 00:02:00,977 So this URL is the conversation API. 44 00:02:00,977 --> 00:02:05,548 >> It's a good habit to actually ensure that the URL provided is exactly the same 45 00:02:05,548 --> 00:02:06,120 indeed. 46 00:02:06,120 --> 00:02:07,119 >> Good point. 47 00:02:07,119 --> 00:02:11,671 And I'm just going to clean up the quotes and other information, 48 00:02:11,671 --> 00:02:14,333 paste in the username and a password. 49 00:02:14,333 --> 00:02:17,809 Now the other thing we have here in the .emv file is the version date. 50 00:02:17,809 --> 00:02:20,407 Can you tell us briefly why this date is important, and 51 00:02:20,407 --> 00:02:22,000 how that relates to versioning? 52 00:02:22,000 --> 00:02:23,742 >> Absolutely. 53 00:02:23,742 --> 00:02:28,613 As you might imagine, we release our software quite frequently under 54 00:02:28,613 --> 00:02:32,998 our Agile methodologies, once every three weeks to be exact. 55 00:02:32,998 --> 00:02:39,385 And this way we are able to update our environmental files, 56 00:02:39,385 --> 00:02:45,785 our hidden .env file with the credentials, with the URL. 57 00:02:45,785 --> 00:02:51,773 And that surface URL is closely tied in to the version where it was released. 58 00:02:51,773 --> 00:02:55,604 >> Okay cool so yeah, if people are testing as of a certain date, if they 59 00:02:55,604 --> 00:03:00,243 leave this version date, they can kind of guarantee that it will work the same way. 60 00:03:00,243 --> 00:03:04,640 All right, so we need to save this change, and now we're ready to hop over to 61 00:03:04,640 --> 00:03:07,966 Terminal and make sure that this runs and we can connect. 62 00:03:07,966 --> 00:03:10,846 >> If you're not very comfortable with the Terminal, don't worry about it, 63 00:03:10,846 --> 00:03:12,154 we're not gonna use it very much. 64 00:03:12,154 --> 00:03:15,919 We just need it to start and stop our running app here. 65 00:03:15,919 --> 00:03:18,928 On a Mac, you can bring up Terminal by hitting Command space, or 66 00:03:18,928 --> 00:03:22,124 hitting the little Search bar in the upper right and type Terminal. 67 00:03:22,124 --> 00:03:24,748 I have mine open already, so I'm gonna Escape out of here. 68 00:03:24,748 --> 00:03:27,778 And Armin, how should students go about it on Windows? 69 00:03:27,778 --> 00:03:32,598 On Windows, Ben, typically we would go to the Start menu and really issue 70 00:03:32,598 --> 00:03:37,990 the command CMD and it would bring up the command prompt for us to run our services. 71 00:03:37,990 --> 00:03:38,930 >> Okay, cool. 72 00:03:38,930 --> 00:03:42,576 Now we're gonna change into the Directory where we unzipped our project. 73 00:03:42,576 --> 00:03:44,027 And we can do that through the Command line. 74 00:03:44,027 --> 00:03:47,486 But there is also a little trick you can use, if you have the folder open, 75 00:03:47,486 --> 00:03:49,835 you want to make sure you grab the parent folder. 76 00:03:49,835 --> 00:03:52,157 It has, what is the important files for the project? 77 00:03:52,157 --> 00:03:53,805 It's the app.JS? 78 00:03:53,805 --> 00:03:55,373 >> Yes, very well. 79 00:03:55,373 --> 00:04:00,013 It's the app.JS that we want to have visible, 80 00:04:00,013 --> 00:04:05,005 especially wherever we are running our commands. 81 00:04:05,005 --> 00:04:07,840 >> Right, so yeah, app.js the manifest and the things that are important to 82 00:04:07,840 --> 00:04:10,495 the project, that's how we know that we're in the right directory. 83 00:04:10,495 --> 00:04:14,789 So now I'm going to click on the folder and drag it over here and 84 00:04:14,789 --> 00:04:17,693 changes my directory to that exact path. 85 00:04:17,693 --> 00:04:20,397 >> I have to click over here, hit Enter, and here we go. 86 00:04:20,397 --> 00:04:21,071 We're in the right spot. 87 00:04:21,071 --> 00:04:21,787 >> Excellent, Ben. 88 00:04:21,787 --> 00:04:28,026 It's a good habit to do an LS list to see the contents of our folder. 89 00:04:28,026 --> 00:04:32,553 And now we have justification that we are indeed at the right spot. 90 00:04:32,553 --> 00:04:33,597 >> Excellent, all right. 91 00:04:33,597 --> 00:04:35,990 So from here- >> That's wonderful, Ben. 92 00:04:35,990 --> 00:04:39,868 I think we're ready to run the node package manager. 93 00:04:39,868 --> 00:04:44,245 As you can imagine, all applications have dependencies. 94 00:04:44,245 --> 00:04:46,276 With Java, it's JRE. 95 00:04:46,276 --> 00:04:51,396 With node packages, we install node package managers. 96 00:04:51,396 --> 00:04:55,135 The way to do that is by tapping in install NPM. 97 00:04:57,654 --> 00:05:01,707 >> Okay, now I've actually already run NPM install for this project. 98 00:05:01,707 --> 00:05:04,160 So, it's already installed the required dependencies. 99 00:05:04,160 --> 00:05:07,215 Otherwise, you would see a big list of everything that was installed here, but 100 00:05:07,215 --> 00:05:09,640 in this case, it's already installed, so we're good to go. 101 00:05:09,640 --> 00:05:14,367 >> And one way to ensure that our packages are installed, Ben, 102 00:05:14,367 --> 00:05:17,518 is if you go into our working directory, 103 00:05:17,518 --> 00:05:21,610 we should be able to see the node package directory. 104 00:05:21,610 --> 00:05:24,422 >> Right, if I go here to node modules and make a big list, 105 00:05:24,422 --> 00:05:26,633 there's everything that was installed. 106 00:05:26,633 --> 00:05:27,887 Wonderful. 107 00:05:27,887 --> 00:05:32,032 So I'm gonna back out and make sure I'm in the parent directory. 108 00:05:32,032 --> 00:05:33,994 And there it is, I see app.js. 109 00:05:33,994 --> 00:05:35,306 And we're ready to try this out. 110 00:05:35,306 --> 00:05:41,320 We can run npm start, which will start the app.js file. 111 00:05:41,320 --> 00:05:44,408 And okay, it says that the server is running on port 3000. 112 00:05:44,408 --> 00:05:46,661 Great, so we want to remember that number, 3000. 113 00:05:46,661 --> 00:05:52,085 Wonderful, we go to a browser and we'll open a new tab and 114 00:05:52,085 --> 00:05:55,927 our URL would be localhost:3000. 115 00:05:55,927 --> 00:06:00,107 >> And yeah look at this, we've got a working app running on localhost:3000. 116 00:06:00,107 --> 00:06:03,160 And let's try typing something, see if anything happens. 117 00:06:03,160 --> 00:06:06,457 And no, nothing happens yet because we haven't set anything up. 118 00:06:06,457 --> 00:06:09,162 So, this isn't very exciting yet, but it is a big deal. 119 00:06:09,162 --> 00:06:13,388 We have a client app connecting to our brand new conversation service. 120 00:06:13,388 --> 00:06:18,052 >> Folks, in the next section of this course we're going to build 121 00:06:18,052 --> 00:06:22,370 a simple conversation about how to turn on things in a car. 122 00:06:22,370 --> 00:06:27,188 We'll also show you some examples of how to build more complex interactions. 123 00:06:27,188 --> 00:06:27,820 >> See you soon!