node.js Node-PerfectAPI vs Restify.js vs ExpressJS vs Node-APIServer
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10468441/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Node-PerfectAPI vs Restify.js vs ExpressJS vs Node-APIServer
提问by Nick
I'm new to ExpressJS. I want to create API's for my service which will be consumed directly by other servers and also a part of it by mobile apps/browsers. I just discovered Restify, Node-PerfectAPI, Node-APIServer and I don't know what the differences are.
我是 ExpressJS 的新手。我想为我的服务创建 API,这些 API 将直接由其他服务器使用,同时也由移动应用程序/浏览器使用。我刚刚发现了 Restify、Node-PerfectAPI、Node-APIServer,我不知道它们有什么区别。
Can someone kindly elaborate on the differences of each framework and the advantages/disadvantages.
有人可以详细说明每个框架的差异和优点/缺点。
Why would one choose Express/NodeJS vs. Other Frameworks for creating API'S?
为什么会选择 Express/NodeJS 与其他框架来创建 API?
采纳答案by Steve Campbell
Disclaimer: I am the author of node-perfectapi.
免责声明:我是node-perfectapi的作者。
The focus of perfectapi is to make it simple for the developer to go from start to production-ready. It is more abstracted than node-restify. The impact of that is you have less flexibility in the design of your API, but at the same time, you should be able to get something production-ready much quicker, with less expertise.
Perfectapi 的重点是使开发人员从开始到生产就绪变得简单。它比node-restify更抽象。这样做的影响是您在 API 设计方面的灵活性较低,但与此同时,您应该能够以较少的专业知识更快地获得生产就绪的产品。
Both restify and perfectapi have comparable performance.
restify 和 perfectapi 都具有相当的性能。
The links in this answer go to pages that highlight the benefits of each solution.
此答案中的链接指向突出显示每个解决方案优势的页面。
回答by surui
You should also consider https://npmjs.org/package/hapi
您还应该考虑https://npmjs.org/package/hapi
It looks very promising. There's a talk about the framework in https://www.youtube.com/watch?v=Recv7vR8ZlAwhere the main contributor to hapi talks about what makes an API framework tick.
它看起来很有希望。在https://www.youtube.com/watch?v=Recv7vR8ZlA中有一个关于框架的讨论,其中 hapi 的主要贡献者谈论是什么让 API 框架滴答作响。
回答by yadutaf
I'm also working on a similar issue. One of the main difference that may interest you is the performance. I just found a blog post from the developer of "perfect-api" comparing his framework to the 2 others. http://blog.perfectapi.com/2012/benchmarking-apis-using-perfectapi-vs-express.js-vs-restify.js/
我也在研究类似的问题。您可能感兴趣的主要区别之一是性能。我刚刚找到了“perfect-api”开发人员的一篇博客文章,将他的框架与其他两个框架进行了比较。http://blog.perfectapi.com/2012/benchmarking-apis-using-perfectapi-vs-express.js-vs-restify.js/
A comment states that Restify is doing much better now.
评论指出 Restify 现在做得更好。
From my (limited) experience, I would say that express.js is easier to use than Restify and provides some nice tools as connect.js which is exposed. For example, this will avoid you the pain of writing a static file server even thought Connect can still be integrated with Restify.
根据我的(有限的)经验,我会说 express.js 比 Restify 更容易使用,并且提供了一些不错的工具,如暴露的 connect.js。例如,即使认为 Connect 仍然可以与 Restify 集成,这将避免您编写静态文件服务器的痛苦。
On the other hand, Restify will make some common API tasks much easier. For example, it provides a throttle engine along with an API conversioning system which is really necessary in an environment where you deal with clients you do not control.
另一方面,Restify 将使一些常见的 API 任务变得更加容易。例如,它提供了一个油门引擎以及一个 API 转换系统,这在您与不受控制的客户端打交道的环境中非常必要。
回答by Ab Wilson
If you go to node-perfectapi in github you'll see this message in the readme:
如果您转到 github 中的 node-perfectapi,您将在自述文件中看到此消息:
"I am not currently maintaining this package. You should probably look for another tool for what you need."
“我目前没有维护这个包。你可能应该寻找另一种工具来满足你的需要。”
Therefore I conclude you are better off using restify since this is actively maintained.
因此,我得出结论,您最好使用 restify,因为这是积极维护的。

