使用node.js向API发出请求(Making requests to API using node.js)
我正在使用Phalcon Framework的微应用程序功能在PHP中开发API。 此API包括接收GET,POST,PUT,DELETE请求,然后以JSON格式从MySQL数据库(API可访问数据库)返回结果。
我正在开发一个phonegap +离子框架移动应用程序,我需要实时连接所有移动用户。 像聊天一样,从API返回的信息,例如:所有配置文件信息,如姓名,电子邮件,年龄,生日将使用API进行存储和检索。
我的问题是,这里有可能实现node.js,即使使用API返回,插入,更新数据,也可以使应用程序实时? 我需要在用户之间创建交互,例如:有人会实时向其他用户发出朋友请求,如果请求的用户接受请求,则使用api更新mysql数据库,将用户添加到好友列表中。
我想使用API,因为我不想给未来的开发人员,数据库访问。 但性能是我的首要任务。
谢谢!
I'm developing an API in PHP using the micro application feature from Phalcon Framework. This API consists in receiving GET, POST, PUT, DELETE requests then return results from the MySQL database (the API has access to the database) in JSON format.
I'm developing a phonegap + ionic framework mobile application too and I need to connect all mobile users in realtime. Something like a chat, with informations returning from the API, for example: All profile informations like name, email, age, birthday will be stored and retrieved using the API.
My question is, its all possible to implement node.js here to make the app real time even using the API to return, insert, update data? I'll need to create interactions between users, example: Someone will make a friend request to another user in real time, if the requested user accept the solicitation, it uses the api to update the mysql database, adding the user to the friendlist.
I want to use API because I don't want to give the future developers, the database access. But performance is my priority.
Thanks!
原文:https://stackoverflow.com/questions/22354669