How do they integrate front end and back end work together?

3 points by nXqd ↗ HN
I'm just another young and enthusiastic programmer. I have an interest in working with backend stuff and try out new languages. Recently, I find out playing with these stuffs cannot get me to create a real application, because no one wants to use ugly app. So I begin to learn more about UI/UX and front development. But I have a doubt about integrating front end work and back end work. For an example: For front end work, I use tool like yeoman to create UI. Back end, I use rails.

If it's only me working on the whole project, I will work only with rails. But what if I have a another frontend who uses yeoman, which is the good workflow to integrate two work together ?

5 comments

[ 4.8 ms ] story [ 24.4 ms ] thread
I personally use REST APIs (over HTTP/HTTPS) to surface all the backend capabilities. Then it doesn't matter how the frontend is developed.

In your case you would probably want to serve the content(resources) using REST. I am not particularly sure how this is done in Rails but it shouldn't be tough to have your objects serialized into json. You would then write AJAX code in your frontend/client code to interact with the backend via the API.

yes, this is exactly what I'm thinking about. But I concern about security problem, are there any notices that I should know when I develop app this way ?
I think you need to turn your front end code into Rails erb templates. Yeoman might be too large of a tool to use, it seems to replicate some of what Rails provides. Try and extract just the html/css/javascript and then move that over to the views section of your Rails app?
I think about this too, but this gonna be produce more work to back end developer since they have to produce front end code to backend template.
It depends entirely on what kind of system you're building.

A common system design is to have a database, a RESTful API, and then a bunch of clients which interact with the API in order to do whatever they need to do.

The method of integration between the different parts of your system are up to you, but having an API to manage the ultimate state of your system is easy to think about and pretty simple to implement too.

Without knowing more about what kind of system you're trying to build, it's difficult to give you any more concrete advice. Different components will require different things.