I want to try to write an application on the server side of RoR Api on the front of React SPA. I do not understand how to correctly implement routing on the site. I myself would have done something like http://api.site.ru/ And the routers completely coincided with http://site.ru/ but I think that this is not quite true?
Closed due to the fact that it is necessary to reformulate the question so that you can give an objectively correct answer by the participants of D-side , cheops , aleksandr barakin , Grundy , VenZell 20 May '16 at 16:12 .
The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .
1 answer
I never did it myself, but from those projects that I saw, it was just a duplication of the routes. Those. On the front, the necessary routes for api are clearly indicated in the configs. If the front is given by the same application as api - it is possible to automate - provide a view with routes. If it is different, you can try to make a method in the API for getting routes. But I don’t see any special charm in this - only an additional load on the backend.
/api) is an acceptable solution. - Dmitriy Simushev