Sunday 14 August 2016

Play Framework: Setup Activator and Develop Simple Play/Scala Application

Introduction

I'm going to deliver a series of posts on How to develop Highly Scalable and Highly responsive and Highly concurrent Web Applications using Scala, Play and Akka Framework basics.

In this post, I'm going to discuss about the following important things about Play Framework.
  • How to Download and Install Activator
  • How to Develop a Simple Play/Scala App with Activator
  • How to Run Play/Scala App with Activator
I will walk through this application code in depth in my coming posts. Please read my next post to understand the application code.

NOTE:- Recently, Typesafe company has changed it's name to Lightbend.

We can develop Play/Scala applications using Libghtbend Activator very easily. 


Download Lightbend Activator:



  • Please access the Play Framework website
       https://www.playframework.com/download
  • Click on download link as shown below
  

  • Lightbend Activator software looks like as shown below      

Install and Setup Lightbend Activator:

  • Unzip to required location (have Changed the folder name, not mandatory)
  • Set Activator BIN path to System Variable PATH
       PATH=G:\activator-1.3.10\bin


       

We have installed and setup Activator successfully. It's time to start developing Play/Scala applications.


Develop a Simple Play/Scala App With Activator:

Please use the following steps to develop a Simple Play/Scala applications with Lightbend activator.

  • Open CMD prompt at your required location as shown below:
  • Execute "activator new" command as shown below
"activator new" command is used to create base templates of different kinds of applications as shown blow.


Here Activator command list out 6 different kinds of available templates to create Play, Scala and Akka based applications.

  • Please select option 6 from this list as shown below
   
  • Now it ask for application name. Please enter name of your Sample Play/Scala application as shown below
         Here I have given my application name as:  SamplePlayScalaApp
  • Press Enter key
  

It creates an application at current directory and also display some useful commands at the end as shown in the above diagram.

So, our application path is: G:\PlayFramework\SamplePlayScalaApp

We can see this application folder structure as shown below:

I will write another post to discuss about the Play Projects folder structure in detail.

It's time to run and access this sample Play/Scala application.

Run Simple Play/Scala App With Activator:


  • Open CMD prompt at our application root folder as shown below
  • Run "activator run" command to start the application as shown below
       

By observing the log at console, we can see that application is started successfully at 9000 default port number

NOTE:- If you run this application for first, it will definitely takes a lot of time in conecting to the internet and download all required dependencies.
  • Access our application and see the output on Browser as shown below

That's it.

I will walk through this application code in depth in my coming post.


Thank you for reading my tutorials.

Please drop me a comment if you like my tutorials or have any issues/suggestions.

Happy Play Framework Learning!

No comments:

Post a Comment