Your first Scalatra service

To get our first Scalatra service up and running, we need to take a couple of extra steps. The reason is that Scalatra is designed to run in a servlet container (for example, Tomcat or Jetty). While this works great for test and production environments, it doesn't allow us to do some quick prototyping or easily run from SBT or an IDE. Luckily, you can also start the Jetty servlet container programmatically and run your Scalatra service from there. So, in this section, we'll:

  • Start by showing you the dependencies required to run Scalatra
  • Setting up Jetty in such a way that it can run our Scalatra REST service
  • Creating a simple Scalatra service that responds to a specific GET request

First, let's look at the dependencies ...

Get RESTful Web Services with Scala now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.