Socialized is an example of a full-featured application, which has been developed to demonstrate two (of three) distinct use cases for MEANS.js:
- Using MEANS.js to build a Play application (Scala.js + AngularJS front-end, Play and Scala RESTful backend).
- Using MEANS.js to build a MEAN application (Scala.js + AngularJS front-end, Node and Scala.js RESTful backend).
Learning a new framework or API can be difficult; however, the learning curve can be greatly reduced when one is provided with good examples. I figured what could be better than a full-fledged application as an example! Socialized also has been a great test bed for me in terms of ensuring that most of the features offered by the facade work as advertised.
- [Scala 2.11.8+] (http://scala-lang.org/download/)
- [Scala.js 0.6.8] (http://www.scala-js.org/)
- [SBT 0.13.11+] (http://www.scala-sbt.org/download.html)
- [MEANS.js 0.1.12] (https://github.com/ldaniels528/MEANS.js)
To build the MEANS.js + Play application (distibutable .ZIP) do the following:
$ sbt "project playapp" dist
Optionally, you could run the application directly from the sources:
$ sbt "project playapp" run
The above will startup the application on port 9000 by default.
Prior to building the code, you need to install the bower and node modules. NOTE: You only need to perform this step once.
$ cd app-nodejs
$ npm install
$ bower install
$ cd ..
Now, you can compile the Scala.js sources to JavaScript by executing the following command:
$ sbt "project nodejs" fastOptJS
$ cd ./app-node
$ node ./dev-server.js
The above will startup the application on port 1337 by default. To listen/bind to a different port. Set the "port" environment variable.
$ export port=8000
Then (re)start the application.