Setting up a basic Play/Scala application with Slick

The following technologies are used throughout this tutorial:
  • Java 8 
  • Play Framework 2.4.3 that comes with activator 1.3.5 
  • Slick 3.0 
  • Intelli IDE 14.1 
  • sbt.version 0.13.8
Operating System : Windows 7

The best part of Play is that , it comes with activator which eliminates the need to install all the above into your local machine(except IDE) . Just installing activator can get you the you the basic web application created , up and running in just 3 steps !

Step 1 : Get the Typesafe Activator

Typesafe Activator is a single download to get you started building Reactive applications. Activator includes the SBT build tool.

As a first step of the tutorial, you need to download the Latest Typesafe Activator (downloading the mini-package should be sufficient ). Once you click on the download the mini-package , the download starts immediately . It takes less than one minute to download !

Extract the downloaded rar contents into a location where you have write privileges . For this tutorial I choose C drive . Now , the path to my activator is - C:\activator-1.3.5

Before running the activator command , you need to set its path else you would encounter the following error:
'activator' is not recognized as an internal or external command, operable program or batch file.

In case you don’t know how to set the path on windows , see here.

This completes the installation of activator on your machine and now you are all set to run the activator !!

Step 2 : Create your first Play application using Activator

Open the command prompt and navigate to the path where want to create your first Play application ( for this tutorial I choose E:/ )
Give the command - activator new .
Activator now displays you a set of templates to choose. For this tutorial we need to select play-scala template , so type 6 and hit enter.

Congrats your first Play-Scala application is created !!

Step 3 : Run your Play application on the local host

Navigate to the root path of your application (E:/MyFirstPlay)
Give the command - activator run.
That’s it , you can see your application up and running on http://localhost:9000 . Get ready to Play !!!

Congrats your first Play-Scala application is created !!

We have Play and Slick , now let's add Slick support to it

No comments:

Post a Comment