Structuring Rails and Angular

I would like to create a new one-page application using Rails 4 and Angular and Capistrano for the deployment process. I want the whole front end to be a static application on Amazon S3 , but I am open to other suggestions. What matters to me is a fast-paced process that can scale easily.

I was wondering what is the best structure I should use:

  • save all assets in the application / assets and set the Bower path to the vender directory. that way, I can use rails precompilation methods and use the Rails html tags for index.html, but I'm sure it will be easy to upload it to S3 and leave it divided.

  • save all assets, including Bower components in the public / app directory, which will save it as a complete separate application, but then I need to use Grunt or any other service to precompile the assets.

  • any other idea?

+4
source share
2 answers

, , :

  • API- (Rails/Sinatra/Grape/ Node/) JSON API. , api.yourapp.com. Access-Control.
  • -: yoman AngularJS, Gulp, Bower. gulp aws S3.

apis ( Rails).

:

  • S3 Angular URL- HTML5. , - S3 .
  • Facebook OpenGraph, .
  • Google/SEO Angular. .

, -. - , node .. .

:

  • - www.yourapp.com ( ) S3. URL- (html5Mode) - - index.html.
  • OpenGraph - API , URL- . - API URL ( ) index.html.
  • SEO - , prerender , .

-

/ . . - cookie, www.yourapp.com - . - cookie .

+4

-, , , .

  • → API

, Rails, .

, Angular, () grunt ( ).

S3 Capistrano, , aws CLI, .

CDN. - Fastly Amazon S3.

Rake, S3, ( ).

Rails, API,

, (Rails) (Angular).

, Rails Rails ..

, " " - , , .

, API, - . , .

9/9/15

, , , . , .

, , , rails-api - ( ).

+3

Source: https://habr.com/ru/post/1606373/


All Articles