Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
      You have completed Build a REST API in Spark!
      
    
You have completed Build a REST API in Spark!
Preview
    
      
  Let's discuss the project for this course
Prerequisites
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
                      [MUSIC]
                      0:00
                    
                    
                      Hello and welcome.
                      0:05
                    
                    
                      I'm Craig and I'm a developer.
                      0:06
                    
                    
                      In this workshop we are going to take on
task of implementing an SQL-backed REST API
                      0:07
                    
                    
                      using the Java micro web framework Spark.
                      0:13
                    
                    
                      So I hope you understood that
mouthful of words I just spouted out.
                      0:16
                    
                    
                      If not, there's some prerequisites
to this workshop that I've listed in
                      0:19
                    
                    
                      the teacher's notes.
                      0:23
                    
                    
                      Now, after reviewing those,
we'll be on the same page and
                      0:24
                    
                    
                      talking the same language.
                      0:26
                    
                    
                      As always, there are video controls
to slow me way down and speed me up.
                      0:28
                    
                    
                      If I start getting bored.
                      0:33
                    
                    
                      The ability to build a REST API
is becoming more and
                      0:35
                    
                    
                      more a required skill that you absolutely
need to have in your Java tool belt.
                      0:38
                    
                    
                      Client side framework are taking off and
                      0:43
                    
                    
                      they expect a backend server
to do all the heavy lifting.
                      0:45
                    
                    
                      They all almost follow
REST out of the box.
                      0:49
                    
                    
                      Mobile applications have exploded and
just about every company has or
                      0:51
                    
                    
                      wants a mobile app these days.
                      0:56
                    
                    
                      These apps need to talk to
the existing infrastructure and
                      0:58
                    
                    
                      usually they do that using REST.
                      1:01
                    
                    
                      So, what better way to get started
exploring building a REST API
                      1:03
                    
                    
                      than using a very straightforward
approach to the problem.
                      1:07
                    
                    
                      Spark is once again is
going to do this for us.
                      1:10
                    
                    
                      I thought we'd take a chance with this
project to also explore using a database
                      1:13
                    
                    
                      implementation and land on a friendly
middle ground between raw SQL and
                      1:17
                    
                    
                      an object relational mapper.
                      1:21
                    
                    
                      We'll also explore using a package that
allows us to take our model objects and
                      1:23
                    
                    
                      turn them into JSON or
JavaScript Object Notation.
                      1:27
                    
                    
                      So the project that we're going to be
building together is a public facing
                      1:31
                    
                    
                      REST API that will allow people
to review online courses.
                      1:34
                    
                    
                      Now there are a ton of online tutorials
and we'll be providing a way for
                      1:38
                    
                    
                      people to submit a brand new course.
                      1:42
                    
                    
                      For instance, something like this.
                      1:44
                    
                    
                      A course might be how to beat angry birds.
                      1:46
                    
                    
                      That's what the course looks like.
                      1:48
                    
                    
                      And then after that you can
submit reviews for each course.
                      1:50
                    
                    
                      Like a glowing one.
                      1:53
                    
                    
                      Five stars.
                      1:54
                    
                    
                      Loved it.
                      1:55
                    
                    
                      Or one that isn't so great.
                      1:56
                    
                    
                      Obviously, when reviewing tree
house courses these are going to be
                      1:58
                    
                    
                      five out of a possible five.
                      2:00
                    
                    
                      But our API is made to accept
courses from anywhere.
                      2:02
                    
                    
                      So the client of the API can request
a list of courses that have reviews
                      2:06
                    
                    
                      as well as submit a new course and
a new review.
                      2:10
                    
                    
                      This aggregating of information is a
common use case of software as a service,
                      2:13
                    
                    
                      or SAAS.
                      2:18
                    
                    
                      Sound fun?
                      2:19
                    
                    
                      Let's get this party started.
                      2:20
                    
              
        You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up