Trying to use angular.js
and Play Framework 2.1
altogether.
My first step was to install angular.js
and yeoman`: npm, bower, .grunt, ... a full js toolkit. Code organization which seemed "standard".
Then I added Play 2.1 Scala version. Code layout follows the standard from PlayFramework
When I want my angular.js
services to talk to real REST actions I get CORS
problems due to usage of different ports : 9000 (yeoman
) and 9001 (play run 9001
).
Which are the options available? What are the solutions and why? (I don't think there is an unique or Best solution for this).
The candidates, I know are :
play-yeoman sbt plugins (I didn't succeed with my Windows environnement - be kind please).
CORS workarounds (add .withheader to Play results).
WebJars providing "Maven-like" dependencies for JS libraries.
One last important thing is running tests. We need to run the angularjs
test suite (using Karma) easily and we need to run Scala tests too. And, if possible, that someone working with angular can use all the web resources available without too much worrying about its specific environment). The more standard the better, I would say.
Update 1 : The question was meant to discuss the use cases for each solution : their constraints, their appeal, code organization and architecture with multiple applicatons accessing REST Services.