Play Framework Tutorial
-
Upload
assistsoftware -
Category
Software
-
view
168 -
download
2
Transcript of Play Framework Tutorial
A Play Framework Tutorial
What is Play Framework
• An open-source modern web framework
• Based on a lightweight, stateless, web-friendly architecture.
• Built on Akka, Play provides predictable and minimal resource consumption
• Developer friendly
• Has great support for Eclipse and Intellij IDEA.
• Provides RESTful by default
• Has a built-in JSON module and extensive NoSQL & Big Data Support.
• There are libraries for everything - most of which can be used in Play.
System Requirements
• Install JDK 1.6 or later.
• Install Scala (general-purpose language designed to support clear, concise and type-safe programming). Optional, but good to have, you may also use Java.
• Install SBT is an open source build tool for Scala and Java projects, similar to Java's Maven or Ant.
• Install Play Framework through a tool called Typesafe Activator.
• Install PostgreSQL.
• Install pgAdmin is a comprehensive PostgreSQL database design and management system.
Game Play Tutorial
• Let's create a new vanilla Play Scala application and name it scala-game. Here is the command you need to run it in command-line:
• To start your game from command-line run from your project root folder:
• or (recommanded)
• To view your work go to: http://localhost:9000/
Game Configuration Tutorial
• To add more experience to your Play skills add the following dependencies to your build.sbt file:
• Slick - a modern database query and access library for Scala.
-It allows you to work with stored data and gives you full control
• PostgreSQL JDBC is necessary to connect to PostgreSQL database
Game Configuration Tutorial
• Then, create a database and add its credentials to application.config file.
• Add a package named dao to your app folder
• Define database tables and set it in configuration
• Uncomment evolution plugin and set it enabled
• Play Framework's Evolutions will create tables and relations between them (primary keys, indexes, sequences etc...) for you.
Game Configuration Tutorial
• We have to specify to which database to connect creating a trait named PostgresSupport and define an implicit database