Play Framework 2: for lazy developers (part 2)
SBT a Simple Build Tool The command-line of Play is SBT, like Ant, Maven or Gradle, but use Scala for DSL.
We will find a Build.scala file into the project folder.
SBT Dependencies The Build.scala file define a sequence appDependencies. We add the dependency as the following image:
It is used in play.Project as a parameter. Repositories In the same file (Build.scala) adding the "resolvers"
CORE PARTS Routing Can be found under the conf folder, the routes file. Here, the row define how to access server-side using HTTP. Each row have three columns: - the method used in the request - a relative path - the action to be invoked
Action An action is a simple method that has a defined route declaring as the code to be executed when a matching request arrives; are declared in a container (a class Java) that extend the Controller.
Just think: java -> OOP => method scala -> FP => function Template A template file is HTML mixes with Scala code. We can find into app/views folder, index.scala.html.
To begin understand we will try to get the first results modifying the template index.scala.html to:
and refresh the web browser to see…
But, if the message came directly from Apache? we change the value of the argument of index in the Application controller file.
Or just trying to render a JSON
(see the Content-Type)










