如何为您的应用程序提供网络 API
我将编写一个 Ruby 应用程序,该应用程序实现由多个音频和视频编码/处理步骤组成的视频转换工作流程。
该应用程序界面有两个核心功能:
- 排队新视频
- 监控每个视频的进度
用户可以使用用 Ruby on Rails 编写的网站访问这些功能。
挑战是这样的:我想让工作流应用程序成为一个自给自足的应用程序,而不依赖于 Web 视图的存在。
为了实现这种分离,我认为向工作流应用程序添加网络 API 是一个很好的解决方案,因为这允许工作流应用程序驻留在与 Web 服务器不同的服务器上。
我的问题是:对于这样的网络 API,您建议采用哪种解决方案?
一些选择是:
- 实现一个简单的 TCP 服务器并发明我自己的基于字符串的 API
- 使用某种 REST api(我不知道这是否适合这种情况)
- 某种 Web 服务解决方案(SOAP、XML-RPC) )
- 另一个现有框架
请随意分享您对此的想法。
I am going to write a Ruby application that implements a video conversion workflow consisting of multiple audio and video encoding/processing steps.
The application interface has two core features:
- queueing new videos
- monitoring the progress for each video
The user can access these features using a website written in Ruby on Rails.
The challenge is this: I want make the workflow app a self-sufficient application, not dependent on the existence of the web view.
To enable this separation I think that adding a network API to the workflow application is a good solution because this allows the workflow app to reside on a different server than the web server.
My question is: Which solution do you suggest for such a network API?
A few options are:
- implement a simple TCP server and invent my own string based API
- use some sort of REST api (I don't know if this is appropriate for this situation)
- some sort of web-services solution (SOAP, XML-RPC)
- another existing framework
Feel free to share your thoughts on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议两件事:
首先,使用 REST 作为您的 API。这使您可以编写一个核心应用程序,其中包含用户界面和供外部应用程序使用的 API。
其次,看看PandaStream。它是一个 Merb 应用程序,可将多种格式的视频编码到 Flash 中。它有一个 REST API,甚至还有一个 Rails 插件,以便您可以将其与您的应用程序集成。它可能是一个很好的示例代码库,甚至可以替代您尝试构建的代码库。
希望我的回答有帮助,
迈克
I would suggest two things:
First, use REST as your API. This allows you to write one core application with both a user interface and an API for outside applications to use.
Second, take a look at PandaStream. It's a Merb application that encodes videos from multiple formats into flash. It has a REST API, and there's even a Rails plugin so you can integrate it with your application. It might be a good example codebase, or even a replacement for the one you're trying to build.
Hope my answer helped,
Mike