O'Reilly logo

RESTful Web Services with Scala by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with the routes file

In the previous section, we saw a very small routes file; it only contained a single line which handled a GET request to the /hello path. For this example, we'll use the following routes file (step01.routes in the routes folder):

POST     /tasks       controllers.Step1.createTask
GET      /tasks       controllers.Step1.getTasks
GET      /tasks/:id   controllers.Step1.getTask(id: Long)
DELETE   /tasks/:id   controllers.Step1.deleteTask(id: Long)
PUT      /tasks/:id   controllers.Step1.updateTask(id: Long)

GET         /*path    controllers.Step1.notImplemented(path: String)
POST        /*path    controllers.Step1.notImplemented(path: String)
PUT         /*path    controllers.Step1.notImplemented(path: String)
DELETE      /*path    controllers.Step1.notImplemented(path: String)

In this route file, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required