Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Angularjs Development Process [closed]

I've been using Angularjs with Rails and as I get further into it I am finding Rails and Angularjs each taking on a character as separate apps. I have also experimented with Yeoman some and I really like it - I tried just to use yeoman to build an app in the assets subdirectory of my Rails app but it creates too much stuff

I am thinking of just splitting it up and creating my Rails app with a json frontend and create a separate Angular app build it with Yeoman and put the finished Angularjs app in my assets subdirectory and do some tiding up

Does this Make Sense?

Anyone else doing this?

Any tips?

like image 758
tbrooke Avatar asked Apr 07 '13 18:04

tbrooke


1 Answers

You're right in that the backend Rails and frontend SPA should not be developed as a single project. They should be developed independently, and also tested independently. Ideally, there should be no direct interaction between them outside of your staging env and your integration e2e tests.

Another thing is you don't need to put your angular app inside your public directory. Most probably you're going to have Passenger/Unicorn/Puma serve your Rails app, and they're not necessary to serve your Angular app. It's better to serve them directly from a hardened webserver like NginX. Not only are they much faster, they are also more configurable. This frees you to even set up custom-origin CDNs to further speed up your site's response time.

Yeoman generators are made precisely for this. If you were going to build both your SPA and Rails together, you wouldn't need all those Grunt tasks for converting LESS/Coffee/Jade etc; Rails would automatically do them for you. They were designed to streamline developing SPAs without a full server environment.

like image 151
abject_error Avatar answered Sep 26 '22 01:09

abject_error