Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here


Example Play Scala application showing REST API

Subscribe to updates I use play-scala-rest-api-example

Statistics on play-scala-rest-api-example

Number of watchers on Github 149
Number of open issues 5
Average time to close an issue 6 days
Main language Scala
Average time to merge a PR 1 day
Open pull requests 3+
Closed pull requests 11+
Last commit over 2 years ago
Repo Created almost 4 years ago
Repo Last Updated over 2 years ago
Size 212 KB
Homepage https://developer...
Organization / Authorplayframework
Page Updated
Do you use play-scala-rest-api-example? Leave a review!
View open issues (5)
View on github
Fresh, new opensource launches 🚀🚀🚀
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating play-scala-rest-api-example for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)


Build Status

This is the example project for Making a REST API in Play.



You need to download and install sbt for this application to run.

Once you have sbt installed, the following at the command prompt will start up Play in development mode:

sbt run

Play will start up on the HTTP port at http://localhost:9000/. You don't need to deploy or reload anything -- changing any source code while the server is running will automatically recompile and hot-reload the application on the next HTTP request.


If you call the same URL from the command line, youll see JSON. Using httpie, we can execute the command:

http --verbose http://localhost:9000/v1/posts

and get back:

GET /v1/posts HTTP/1.1

Likewise, you can also send a POST directly as JSON:

http --verbose POST http://localhost:9000/v1/posts title="hello" body="world"

and get:

POST /v1/posts HTTP/1.1

Load Testing

The best way to see what Play can do is to run a load test. We've included Gatling in this test project for integrated load testing.

Start Play in production mode, by staging the application and running the play script:s

sbt stage
cd target/universal/stage
bin/play-rest-api-example -Dplay.crypto.secret=testing

Then you'll start the Gatling load test up (it's already integrated into the project):

sbt gatling:test

For best results, start the gatling load test up on another machine so you do not have contending resources. You can edit the Gatling simulation, and change the numbers as appropriate.

Once the test completes, you'll see an HTML file containing the load test chart:


That will contain your load test results.

play-scala-rest-api-example open issues Ask a question     (View All Issues)
  • almost 3 years move to Scala 2.12
  • about 3 years Forward port additional tests to 2.6.x branch
play-scala-rest-api-example open pull requests (View All Pulls)
  • Use @ref to link to other .md pages
  • dockerizing sample app with sbt-native-packager
  • Upgrade branch 2.6.x using TemplateControl
play-scala-rest-api-example list of languages used
Other projects in Scala