Learn Play - 1 Code Examples & CST Typing Practice Test
Play Framework is a high-velocity, reactive web framework for Java and Scala, designed for building modern web applications and RESTful services. It emphasizes developer productivity, statelessness, and asynchronous I/O.
View all 1 Play code examples →
Learn PLAY with Real Code Examples
Updated Nov 27, 2025
Code Sample Descriptions
Play Simple REST API
// app/controllers/ItemController.scala
package controllers
import play.api.mvc._
import play.api.libs.json._
import javax.inject._
case class Item(id: Int, name: String)
object Item { implicit val format = Json.format[Item] }
@Singleton
class ItemController @Inject()(val controllerComponents: ControllerComponents) extends BaseController {
private var items = Seq(Item(1, "Item 1"), Item(2, "Item 2"))
def list = Action {
Ok(Json.toJson(items))
}
def add = Action(parse.json) { request =>
val newItem = request.body.as[Item]
items = items :+ newItem
Created(Json.toJson(newItem))
}
}
// conf/routes
GET /items controllers.ItemController.list
POST /items controllers.ItemController.add
Demonstrates a simple Play controller with routes for listing and adding items using Scala.
Frequently Asked Questions about Play
What is Play?
Play Framework is a high-velocity, reactive web framework for Java and Scala, designed for building modern web applications and RESTful services. It emphasizes developer productivity, statelessness, and asynchronous I/O.
What are the primary use cases for Play?
Building reactive web applications. Creating RESTful APIs. Developing microservices and backend services. Rapid prototyping with hot reload. High-concurrency applications
What are the strengths of Play?
High-performance and scalable. Reactive programming support. Hot reload for faster development. Supports both Java and Scala. Strong community and Lightbend ecosystem integration
What are the limitations of Play?
Smaller ecosystem than Spring Boot or Laravel. Learning curve for reactive and asynchronous programming. Less suitable for small static websites. Requires JVM knowledge. May be overkill for simple CRUD apps
How can I practice Play typing speed?
CodeSpeedTest offers 1+ real Play code examples for typing practice. You can measure your WPM, track accuracy, and improve your coding speed with guided exercises.