I started by creating a default Play application and reused most of the business-side logic I had used in the previous version of the app. I then created a folder in the root of my project called 'vue' and I put all my Vue related files in there. I am using Play as a RESTful service and Vue as a client-side rendering framework. The only Play Scala template I have is the index.scala.html page which references the bundled javascript file and defines the root element for the Vue application. The only reason I have this index file within Play is to do with the Javascript routing provided by Play. Having said that I think in the long run I will move the index file into the Vue project in order to make use of Vue's hot-reload feature.
If you are interested in this sample application I have built you can clone / downloaded it from here.
Introduction
This application is used to showcase the Play framework as well as Vue.js while learning basic Spanish phrases. This application makes use of the following:Installing
- Download Play 2.5.x (activator)
- Install Play
- Download Node.js
- Install Node.js
- Open a command prompt
- Run `npm install`
- Download / clone the sample application
- https://github.com/rossma/pizarra-alpha.git
Running
- Open a command terminal and change into the sample application root directory
- Run activator:
- activator run
- Run webpack:
- webpack --watch
- Open the following link in a browser:
- http://localhost:9000