Angular JS front end with REST api powered by Spray. Typesafe Activator template created by Credera
Start the application with activator run
(or sbt run
, same thing).
Navigate to the home page http://localhost:8080/index.html to see the Angular app
Or do a GET request to http://localhost:8080/api/person to hit the REST endpoint directly
The \dist
directory has been included in the project and is already built including minification.
Running the server will serve the app from here so that it runs out of the box. Any changes you make in here will get clobbered next time
you build the front end with grunt. Normally this folder is not included in source control.
For front end development make your changes to the \app
folder and follow the steps below:
Front end requires Bower, which requires npm
But this is an scala app and I already have SBT!! For the front end dependency management you will need npm.
Options
- https://www.npmjs.org/doc/README.html
brew install npm
Bower is a front end dependency manager npm install -g bower
(Linux users might have to run with sudo)
Download all the front end dependencies with bower install
They will be in your app\bower_components
directory as instructed by .bowerrc
Grunt is a front end task runner
npm install -g grunt-cli
Wire up the dependencies with grunt bowerInstall
This modifies app\index.html
to include your dependencies
Lastly in /src/main/scala/com/example/actors/routes/ApiRouterActor.scala
change where static content is served from:
getFromResourceDirectory("dist")
//becomes
getFromResourceDirectory("app")