How to create communication API between my website and my Client's website

我与影子孤独终老i 提交于 2019-12-12 05:48:49

问题


I would like to create a communication API between my website which was built using rails and another website, so I can send data from my database to there website. So my idea is to use node.js where I will create real-time, so it will work in the following procedure. My Database is connected to rails, rails will send it to redis and then redis will send it to node finally node will send it to the other website using socket.IO

The question: Is that valid? Is there easier way?


回答1:


Use just rails, create a controller and action that returns a json.

You can use https://github.com/rails-api/rails-api to speed things up.




回答2:


I don't think that is a good way You should consider lowering your dependency chain (DB -> Rails -> Redis -> node -> client) Is redis necessary? (you can connect node to your DB, if you need realtime) And if you don't need a realtime system, consider using http instead, you can return any type in rails (your own json, html, ...)



来源:https://stackoverflow.com/questions/29964613/how-to-create-communication-api-between-my-website-and-my-clients-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!