Question

How does one handle the differences in routing between client side routing in Angular and server side routing in Rails? Do you have to choose one or the other? For example if I have a Rails application backend and an Angular application frontend, would I have to use the location service to determine which requests to make to my Rails server if I'm using Angular routing? And if I am using Rails routing would I be required to manually keep track of all my controllers interactions and dependencies on the main module? Are there benefits or drawbacks from using one or the other, is it even possible to combine the two?

Was it helpful?

Solution

Actually, you have to do routing on both side. On your angular app side you will need to manage the routing of your pages and on the rails side you need to manage the routing for requests sent to the server. For example, on the app i'm switch page and looking at different pages, angular can do that (altough you could ask your rails server to render the html pages). Let's say i am creating an user, you will need to route the request on the server side to access the controller to create a user model.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top