1 00:00:00,000 --> 00:00:05,026 [MUSIC] 2 00:00:05,026 --> 00:00:08,990 By default, browsers send GET requests, which makes them easy to test. 3 00:00:08,990 --> 00:00:12,530 Just hop into a browser and send a request to an endpoint. 4 00:00:12,530 --> 00:00:14,480 If you get back the information you were expecting, 5 00:00:14,480 --> 00:00:16,150 you know the route is working as intended. 6 00:00:17,200 --> 00:00:20,120 Sending other types of request from the browser, like POST or DELETE, 7 00:00:20,120 --> 00:00:21,730 can be a little trickier. 8 00:00:21,730 --> 00:00:25,090 Postman is an application that will allow us to send a variety of requests 9 00:00:25,090 --> 00:00:29,670 to our API so that we can write endpoints to create, update, and delete quotes. 10 00:00:29,670 --> 00:00:32,170 And then make sure our application is functioning as we expect. 11 00:00:33,380 --> 00:00:35,240 Visit the link in the teacher's notes and 12 00:00:35,240 --> 00:00:38,150 follow the instructions to download Postman. 13 00:00:38,150 --> 00:00:41,350 After you've done that, open up Postman, and let's take a look. 14 00:00:41,350 --> 00:00:44,690 If you get any pop-ups when you first open the app, go ahead and 15 00:00:44,690 --> 00:00:46,440 close them out for now. 16 00:00:46,440 --> 00:00:48,390 Notice here on the left side, 17 00:00:48,390 --> 00:00:52,240 we have a drop-down menu containing many types of requests. 18 00:00:52,240 --> 00:00:53,830 Let's stay on GET for now. 19 00:00:53,830 --> 00:00:57,580 And here we type the URL that we want to send a request to. 20 00:00:57,580 --> 00:01:03,430 Make sure your server is running, so I'll go back to my terminal and type npm start. 21 00:01:03,430 --> 00:01:05,300 My server is already running, so that's great. 22 00:01:06,360 --> 00:01:09,536 Now that the server is running, can return to Postman. 23 00:01:09,536 --> 00:01:14,122 And we'll send a GET request to our application's 24 00:01:14,122 --> 00:01:18,822 /quotes route, localhost:3000/quotes. 25 00:01:18,822 --> 00:01:24,440 Click Send, and this area here on the bottom shows our server's response. 26 00:01:24,440 --> 00:01:29,480 We've sent a GET request and we've received an array of quote objects. 27 00:01:29,480 --> 00:01:33,660 Now let's try sending a GET request to a URL containing a quote ID. 28 00:01:33,660 --> 00:01:39,130 Send a GET request to localhost:3000/quotes/8721. 29 00:01:40,753 --> 00:01:44,310 And we receive just that specific quote object back. 30 00:01:44,310 --> 00:01:46,310 Notice the status code here. 31 00:01:46,310 --> 00:01:50,230 These are status codes sent by our server to inform the client of the status of 32 00:01:50,230 --> 00:01:51,190 the request. 33 00:01:51,190 --> 00:01:56,070 When a request is successful, Express sends a status code of 200 automatically. 34 00:01:56,070 --> 00:01:59,868 We'll learn more about status codes and how to set them later on in the course. 35 00:01:59,868 --> 00:02:03,090 We'll use Postman for the rest of the course to test our routes. 36 00:02:03,090 --> 00:02:03,820 In the next video, 37 00:02:03,820 --> 00:02:07,468 we'll write a POST route to add a new quote to our data store. 38 00:02:07,468 --> 00:02:11,410 And use Postman to send data and make sure our API is working as expected.