Typesafe Activator

Hello Play Framework (Scala Only)

Hello Play Framework (Scala Only)

typesafehub
Source
April 20, 2014
basics playframework scala starter

Play Framework is the High Velocity Web Framework for Java and Scala. Play is based on a lightweight, stateless, web-friendly architecture. Built on Akka, Play provides predictable and minimal resource comsumption (CPU, memory, threads) for highly-scalable applications. This app will teach you how to start building Play 2.2 apps with Scala.

How to get "Hello Play Framework (Scala Only)" on your computer

There are several ways to get this template.

Option 1: Choose hello-play-scala in the Typesafe Activator UI.

Already have Typesafe Activator (get it here)? Launch the UI then search for hello-play-scala in the list of templates.

Option 2: Download the hello-play-scala project as a zip archive

If you haven't installed Activator, you can get the code by downloading the template bundle for hello-play-scala.

  1. Download the Template Bundle for "Hello Play Framework (Scala Only)"
  2. Extract the downloaded zip file to your system
  3. The bundle includes a small bootstrap script that can start Activator. To start Typesafe Activator's UI:

    In your File Explorer, navigate into the directory that the template was extracted to, right-click on the file named "activator.bat", then select "Open", and if prompted with a warning, click to continue:

    Or from a command line:

     C:\Users\typesafe\hello-play-scala> activator ui 
    This will start Typesafe Activator and open this template in your browser.

Option 3: Create a hello-play-scala project from the command line

If you have Typesafe Activator, use its command line mode to create a new project from this template. Type activator new PROJECTNAME hello-play-scala on the command line.

Option 4: View the template source

The creator of this template maintains it at https://github.com/typesafehub/activator-hello-play-scala#master.

Option 5: Preview the tutorial below

We've included the text of this template's tutorial below, but it may work better if you view it inside Activator on your computer. Activator tutorials are often designed to be interactive.

Preview the tutorial

You've just created a simple Play Framework application! Now lets explore the code and make some changes.

View the App

Once the application has been compiled and the server started, your application can be accessed at: http://localhost:9000
Check in Run to see the server status.
When you make an HTTP request to that URL, the Play server figures out what code to execute which will handle the request and return a response. In this application the request handler for requests to the root URL (e.g. "/") are handled by a Java Controller. You can use Java and Scala to create your controllers.
Controllers asynchronously return HTTP responses of any content type (i.e. HTML, JSON, binary).

UNDER CONSTRUCTION

Further Learning

The Play Documentation contains much more exhaustive details and also covers a number of other topics which haven't been addressed in this tutorial.
StackOverflow is a great place ask questions about Play.
The play-framework Google Group is a great place to discuss Play.

comments powered by Disqus