How to organize the REST API and the site frontend? [closed]

0

I am creating a Single Page Application, for this, I created a Restful API in Node.js that does all the actions in the database, login, sending emails and etc. I thought about creating a "public" folder in my project and put there my front end. But I think that some time I will have a conflict between the routes of Node.js and my front end. I thought about leaving the API running on one port and the front end running on another port. As if they were separate projects.

What is the most used form in the organization of projects that use Single Page Application, Restful API and etc?

    
asked by anonymous 09.08.2016 / 01:49

1 answer

0

When I create applications of this type I do the way you are building. I leave my application in node running in one container and my web application running in another. I think it's the best way to do this communication between them (using the vue.js front-end). Since the node is serving an API to your front end I see no problem doing so.

It may also be legal to separate the node and application on separate servers. But I do not think it's your intention.

There is no "right" way to build something like this. It will depend a lot on how you like to build your application and [how important] it will be used. If you're going to use it in other application types, such as in an android application, it might be best to separate the back-end application from the front end to avoid what you said: conflict.

There is no right answer to this question, but I think you can understand. Hugs! : D

    
09.08.2016 / 01:54