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.
Some aims/thoughts
Rails serve json via api’s, possibly looking at Grape. Lean on the asset pipeline to comine and minify To embedd angular within the assets, using a organisation by modules and not layers.
Alternatives to the asset pipline would be lean on grunt and yoman to manage the angular app outside of rails, but compile into the public dir. This would then be easy when saty behind the likes of nginx.
Or rather, avoid learning node as a json api server, avoid cross domain requests, avoid 2 seperate applications.
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.
-
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.
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:
├── app │ ├── admin │ │ ├── admin_user.rb │ │ ├── dashboard.rb │ │ ├── site.rb │ │ └── user.rb │ ├── assets │ │ ├── images │ │ │ └── rails.png │ │ ├── javascripts │ │ │ ├── active_admin.js │ │ │ ├── app │ │ │ │ ├── app.js │ │ │ │ ├── header.tpl.html │ │ │ │ └── info │ │ │ │ ├── info.html │ │ │ │ └── info.js.erb │ │ │ ├── application.js │ │ │ └── common │ │ ├── stylesheets │ │ │ ├── active_admin.css.scss │ │ │ ├── application.css.scss │ │ │ └── overrides.css.scss │ │ └── templates │ │ └── info.html │ ├── controllers │ │ ├── api │ │ │ └── v1 │ │ │ ├── info_controller.rb │ │ │ ├── sessions_controller.rb │ │ │ └── sites_controller.rb │ │ ├── application_controller.rb │ │ └── home_controller.rb │ ├── helpers │ │ ├── application_helper.rb │ │ └── home_helper.rb │ ├── mailers │ ├── models │ │ ├── admin_user.rb │ │ ├── site.rb │ │ └── user.rb │ └── views │ ├── home │ │ └── index.html.erb │ └── layouts │ └── application.html.erb | └── vendor
├── assets │ ├── javascripts │ │ ├── angular-resource.js │ │ ├── angular.js │ │ └── library.js │ └── stylesheets └── plugins