Integrated AngularJS + Rails or separated Angular + Rails API-only (microservices architecture)? - ruby-on-rails

As I understand it, there are two common approaches to running AngularJS (or ReactJS, VueJS etc. same idea...).
Integrate the AngularJS front-end into a Rails application (as in this tutorial)
Run an AngularJS application which communicates with a completely separate Rails API-only back-end a.k.a: microservices architecture (as in this tutorial)
Which approach would be most appropriate from a Software as a Service stand-point?

You can adopt the second approach.
It's more suitable, simple and convenient.
Also it will reduce the complexities which you will face when you will integrate AngularJs as front-end in your Rails Application. Also you can test the application easily

Related

Rails Frontend, Backend, and API

Does your Rails app have to be API-Only to be able to use the API generator? I want to create my fronted and backend using Ruby on Rails. Then build a mobile using the API.
Does your Rails app have to be API-Only to be able to use the API
generator?
No, it can be a normal web application and you can build an API alongside it. The term API-only came from Rails 5 where it introduced a way to generate a Rails API-only applications that are different from normal web applications. For more information, have a look into these guides
You can access your API throught a different route, as in www.myapp.com/api/request, and access your Rails application throught www.myapp.com/request, for example

Token-based Authentication - Ruby on Rails

I need to generate a User and Admin login page. I followed the instructions contained in the following link. https://www.pluralsight.com/guides/ruby-ruby-on-rails/token-based-authentication-with-ruby-on-rails-5-api What does api-only app mean?
In normal applications the web pages will be generated and given to browsers. The api-only apps the views will be generated by client apps which runs on browsers. The front-end frameworks will helps you to generate the page according to the data provided from server usually JSON. If you are creating applications which runs on web and other platform specific apps, then you have to create API's using which you can run single app server which serves request independent of platform. You can dive deep into architectures like REST, frameworks like Angular, Backbone, React.
Here the complete guide.
Using Rails for API-only Applications
Update:
For JWT auth I will recommend to use Knock. This is tested and simple solution.

Rails Api + AngularJS + IonicFramework

I want to start a new project and im not sure, if im using the best setup/approach. The project is kind of a list directory without high computing power needed.
I planned to build an website with Rails Api and AngularJs (+Bootstrap) for normal devices and mobile and use the same api for apps too.
Therefore i planned to use the IonicFramework (+PhoneGap). Is this a common approach or are there any best practices i should consider?
This is the standard way to develop web/desktop apps and mobile apps.
You are approaching this correctly.
Use core AngularJS + Bootstrap for web/desktop app and Ionic
Framework for mobile
Sharing the backend Rails API makes sense. Typically the Rails API
would be designed with REST principles in mind which makes it easier
to consume (probably using Restangular) via web/desktop app and
mobile app
If you follow standard AngularJS conventions to create a separation
of concerns (controllers, services, and views) then you will be able
to share quite a bit of JavaScript code between the web/desktop app
and mobile app and easily override functionality to customize for
devices, if necessary.

Real time application with Brunch, Node.js, Socket.io, MySQL, Rails and Ember.js

I'm trying to use Brunch with Rails and Ember.js with Separation of Frontend and Backend then use Node.js and Socket.io for real time updates.
I think this tutorial Adding Real-Time to Rails With Socket.IO, Node.js and Backbone.js
is useful and explains how Rails, Socket.io, Node.js and Backbone.js can be implemented but how would we go about adding Brunch and Ember.js with database integration?
Do we have any suggestions? or are there good tutorial/example out there that we could make use of?

Integrate Brunch with Rails

I'm trying to use below Brunch skeleton and integrate with my Rails app:
Sassy Brunch with Ember and CoffeeSoup
Is there a way to do this so I can still use Brunch operations like build and watch seamlessly within the Rails app?
Or would we rather want to have separate Frontend for Brunch and use Rails as RESTful provider?
Checkout the Breakfast Gem. It integrates Brunch into Rails pretty seamlessly.
Developing Brunch application separately from Rails application is in my opinion idiomatic way of developing web apps:
Ability to synchronously develop frontend and backend. You can simply use static JSON files on your frontend (served from public/) before Rails app is ready.
Ability to make frontend totally independent from backend. There can be many front ends, after all (iOS, for example).
Ability to share frontend code as an example implementation of your API-using-app. In many applications (yeah not all) frontend these days is less important than the backend data itself and backend business logic. I see no reason not to provide third-party developers a convenient example app they can base they code on.

Resources