0

back to all projects

INTRO TO PLAY FRAMEWORK

PLAY FRAMEWORK IS A WEB DEVELOPMENT FRAMEWORK FOR JAVA & SCALA


JAVA

MEDIUM

last hacked on Aug 13, 2017


`Play` is a high-productivity Java and Scala web application development framework that integrates the components and APIs you need for modern web application development. `Play` features the following properties: * **Lightweight** * **Stateless** * **Web-friendly** * **Highly scalable** * Features **reactive model**

# Installing Play First make sure you have `Java 1.8` installed. Check in your terminal: java -version If you don't have `Java 1.8` installed then get it from [http://www.oracle.com/technetwork/java/javase/downloads/index.html](http://www.oracle.com/technetwork/java/javase/downloads/index.html). Proceed to install `sbt`, an interactive build tool that provides all the necessary commands to run your application. Visit [https://www.scala-sbt.org/download.html](https://www.scala-sbt.org/download.html) for more details. brew install sbt [https://images5.alphacoders.com/357/357054.jpg](https://images5.alphacoders.com/357/357054.jpg) # Create a new application using `sbt` To create a new Java application, enter into your terminal: sbt new playframework/play-java-seed.g8 The terminal may prompt you to enter additional information, feel free to simply press the enter key. Then run the server: sbt run Check [http://localhost:9000/](http://localhost:9000/) to see the running server. # View Play Example Projects Visit [https://playframework.com/download#examples](https://playframework.com/download#examples) to see what Play can do. # Play Framework File Structure * PROJECT_NAME * app * conf * logs * project * public * sbt-dist * target * test ----- # Forgive me Have the incorporate the below stuff into the project: ----- What are web sockets? *Play framework caters to these trends:* * Synchronous / blocking --> Async / Non-blocking * Server-side rendering --> Client / Server * Vertical Scalability --> Horizontal scalability * What's an API? --> API first *Play framework is:* * Lightweight * Stateless * Web-friendly * For highly scalable applications We can write our Play framework code in Java and/or Scala. The second version of the Play framework is built in Scala. The Play framework uses Akka. The Akka HTTP modules implement a full server Play framework uses the sbt build tool. *Some Favorite Play framework features:* * Simple * URL routing * Class reloading * Share-nothing * Java & scala support * Great testing support * JPA/EBean Support * NIO Server (Netty) * Asset Compiler * Instant Deployment on Heroku We will need `sbt` to create our Play framework project: sudo apt-get install sbt Make a directory to contain your Play framework project: mkdir <PROJECT_CONTAINER> sbt new playframework/play-java-seed.g8 The terminal should ask you to input the name of your application, which we will refer to as `<PROJECT_NAME>`. cd <PROJECT_NAME> sbt run

COMMENTS


back to all projects