1 00:00:00,000 --> 00:00:05,180 [MUSIC] 2 00:00:05,180 --> 00:00:06,170 Hello and welcome. 3 00:00:06,170 --> 00:00:07,970 I'm Craig and I'm a developer. 4 00:00:07,970 --> 00:00:13,350 In this workshop we are going to take on task of implementing an SQL-backed REST API 5 00:00:13,350 --> 00:00:16,670 using the Java micro web framework Spark. 6 00:00:16,670 --> 00:00:19,860 So I hope you understood that mouthful of words I just spouted out. 7 00:00:19,860 --> 00:00:23,130 If not, there's some prerequisites to this workshop that I've listed in 8 00:00:23,130 --> 00:00:24,160 the teacher's notes. 9 00:00:24,160 --> 00:00:26,980 Now, after reviewing those, we'll be on the same page and 10 00:00:26,980 --> 00:00:28,660 talking the same language. 11 00:00:28,660 --> 00:00:33,400 As always, there are video controls to slow me way down and speed me up. 12 00:00:33,400 --> 00:00:35,240 If I start getting bored. 13 00:00:35,240 --> 00:00:38,370 The ability to build a REST API is becoming more and 14 00:00:38,370 --> 00:00:43,410 more a required skill that you absolutely need to have in your Java tool belt. 15 00:00:43,410 --> 00:00:45,340 Client side framework are taking off and 16 00:00:45,340 --> 00:00:49,160 they expect a backend server to do all the heavy lifting. 17 00:00:49,160 --> 00:00:51,710 They all almost follow REST out of the box. 18 00:00:51,710 --> 00:00:56,430 Mobile applications have exploded and just about every company has or 19 00:00:56,430 --> 00:00:58,460 wants a mobile app these days. 20 00:00:58,460 --> 00:01:01,320 These apps need to talk to the existing infrastructure and 21 00:01:01,320 --> 00:01:03,590 usually they do that using REST. 22 00:01:03,590 --> 00:01:07,830 So, what better way to get started exploring building a REST API 23 00:01:07,830 --> 00:01:10,810 than using a very straightforward approach to the problem. 24 00:01:10,810 --> 00:01:13,960 Spark is once again is going to do this for us. 25 00:01:13,960 --> 00:01:17,250 I thought we'd take a chance with this project to also explore using a database 26 00:01:17,250 --> 00:01:21,690 implementation and land on a friendly middle ground between raw SQL and 27 00:01:21,690 --> 00:01:23,890 an object relational mapper. 28 00:01:23,890 --> 00:01:27,650 We'll also explore using a package that allows us to take our model objects and 29 00:01:27,650 --> 00:01:30,790 turn them into JSON or JavaScript Object Notation. 30 00:01:31,850 --> 00:01:34,960 So the project that we're going to be building together is a public facing 31 00:01:34,960 --> 00:01:38,180 REST API that will allow people to review online courses. 32 00:01:38,180 --> 00:01:42,810 Now there are a ton of online tutorials and we'll be providing a way for 33 00:01:42,810 --> 00:01:44,750 people to submit a brand new course. 34 00:01:44,750 --> 00:01:46,070 For instance, something like this. 35 00:01:46,070 --> 00:01:48,280 A course might be how to beat angry birds. 36 00:01:48,280 --> 00:01:50,320 That's what the course looks like. 37 00:01:50,320 --> 00:01:53,010 And then after that you can submit reviews for each course. 38 00:01:53,010 --> 00:01:54,010 Like a glowing one. 39 00:01:54,010 --> 00:01:55,170 Five stars. 40 00:01:55,170 --> 00:01:56,090 Loved it. 41 00:01:56,090 --> 00:01:57,110 Or one that isn't so great. 42 00:01:58,270 --> 00:02:00,890 Obviously, when reviewing tree house courses these are going to be 43 00:02:00,890 --> 00:02:02,655 five out of a possible five. 44 00:02:02,655 --> 00:02:05,290 But our API is made to accept courses from anywhere. 45 00:02:06,380 --> 00:02:10,600 So the client of the API can request a list of courses that have reviews 46 00:02:10,600 --> 00:02:13,800 as well as submit a new course and a new review. 47 00:02:13,800 --> 00:02:18,030 This aggregating of information is a common use case of software as a service, 48 00:02:18,030 --> 00:02:19,100 or SAAS. 49 00:02:19,100 --> 00:02:20,040 Sound fun? 50 00:02:20,040 --> 00:02:21,120 Let's get this party started.