flavian
flavian

Reputation: 28511

Embedded Jetty 9. Create a Scala servlet

I am looking for the fastest way to create a Scala REST service. Ideally, I would like to build from scratch, learn the tricks of the trade before using a framework.

The REST service should serve JSON pulled from a MongoDB database. The web doesn't seem to be of much help, nor does the book on Scala by Martin Odersky.

Upvotes: 3

Views: 2225

Answers (1)

Paul Butcher
Paul Butcher

Reputation: 10852

I'm not aware of a tutorial or example that will give you exactly what you want, but I'm not really surprised at that. Anyone who wants to create a simple REST service would choose to use a framework, and you don't want to do that. By choosing to build something yourself from the ground up, you're choosing complexity - exactly the complexity that the frameworks exist to remove.

The same is true for Java - virtually nobody creates raw REST services on top of HttpServlet, because using a framework makes much more sense.

Having said that, creating a "raw" REST service in Scala would be virtually identical to doing so in Java. So find a Java/Maven example and do the small amount of work necessary to turn it into something that runs on top of Scala and SBT. This would be a good starting point.

Upvotes: 4

Related Questions