Welcome to DEMO Rails AngularJS
The intention of this project is to connect rails with Angular JS. AngularJS to replace the traditional rails view layer. Rails could of course be any API service, sinatra etc. I'm using rails as I know it (kind of) and it makes backend tasks easier, like email porocessing, queues and so on.
Rails serves json via api's, possibly looking at Grape. Lean on Rails comfort for server tasks, e.g. email, workflow, db access and so on. Lean on the asset pipeline to comine and minify. Which requires:
Embedding angularJS within the assets.
Aiming to use an organisation by modules and not layers. Appears difficult to achieve, layers works and it's in keeping with Rails, even if it's not where I'm at…
Alternatives to the asset pipline would be to utilise the likes of grunt and yoman. These tools can manage the angularJS app outside of rails, but compile into the public dir. This would then be easy when sat behind the likes of nginx.
Pros: Also convienent to pass AngularJS app to non rails developer. Cons: Another component to manage and possibly CORS.
avoid learning node as a json api server avoid 2 seperate applications avoid cross domain requests
There are a number of ways to do the above, there are some points, where I'm not even certain if the approach is right, but it's a path…
Should be viable to clone, migrate and then launch local server. All requests should invoke the home.index which really hands off right away to Angular.
To the many people who have blogged about AngularJS and those who've listened to my questions.
I'd like to thank:
The guys behind angular-app, https://github.com/angular-app/angular-app. It's a cracking reference app and I've leant on it heavily. Nils of http://nils-blum-oeste.net/ for a collection of vital articles on token_auth wrapping.
Description of Contents
The basic goal is a rails 3.2 app, with devise, active_admin, bootstrap, angular and api services (public and auth'd with token_auth).
The initial and relevant directory structure of this application is: