TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: The best language for writing RESTful APIs?

10 点作者 ianseyer将近 10 年前
I&#x27;ve used flask, rails, and padrino (sinatra).<p>Flask was my favorite but is hard to keep organized without much of a toolkit or recommended dev patterns baked in. I recognize that blueprints really help, but a consistent cross-project organization would be nice.<p>The transition to padrino was welcomed due to a lot of basic structure that is consistent in all projects, but unsustainable due to a functionally dead community (#sinatra has 25 people at max and nobody talking, #padrino has maybe 8).<p>Rails is far too much bloat to just be serving JSON (benchmarks show that sinatra is 4-8x faster...) and implies TOO strict a structure to development (also, being a python person...I don&#x27;t appreciate magic).<p>What do you recommend?

11 条评论

jakerella86将近 10 年前
I&#x27;d agree that Node.js is pretty dang nice for RESTful APIs. The fully asynchronous nature means really great throughput on the server, especially when most of your processing time is spent in DB or file I&#x2F;O (as is often the case in APIs). As for disadvantages... I dunno. I guess if you don&#x27;t really know JS very well it could be difficult to get into, and good developers are harder to find than in some other languages. But as a platform for APIs it&#x27;s pretty solid.<p>As for a guide... There&#x27;s a guide for LoopBack specifically here: <a href="http:&#x2F;&#x2F;docs.strongloop.com&#x2F;display&#x2F;LB&#x2F;Getting+started+with+LoopBack" rel="nofollow">http:&#x2F;&#x2F;docs.strongloop.com&#x2F;display&#x2F;LB&#x2F;Getting+started+with+L...</a> That framework was written specifically for writing REST APIs.
评论 #9729780 未加载
bjourne将近 10 年前
&gt; Rails is far too much bloat to just be serving JSON (benchmarks show that sinatra is 4-8x faster...)<p>Does it matter 1 bit? If you can&#x27;t <i>demonstrate</i> that it does, you might as well choose the framework with the best mascot and Django&#x27;s mascot is pretty damn awesome.
评论 #9729711 未加载
评论 #9728766 未加载
brickcap将近 10 年前
I would recommend openresty. A library that allows you to script nginx using a lightweight,easy to learn language lua. You get all the advantages of nginx (unmatched speed and resource efficiency) along with the ability to &quot;inject&quot; lua code into it&#x27;s event loop. Which should be a compelling enough reason for you to give it at least some serious thought.<p>As far as organization of code is concerned openresty does not impose any restrictions on you. But since it is just lua you can bundle you code into modules. And then you can use those modules using &quot;require&quot; much like in node js (though it is slightly different)<p>Also there is lapis[1] and sailor[2] if you are looking for something more organized.<p>[1]<a href="https:&#x2F;&#x2F;github.com&#x2F;leafo&#x2F;lapis" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;leafo&#x2F;lapis</a> [2]<a href="https:&#x2F;&#x2F;github.com&#x2F;Etiene&#x2F;sailor" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Etiene&#x2F;sailor</a>
volgodark将近 10 年前
What about PHP ? You may try Aisel, its uses clean object-oriented PHP <a href="https:&#x2F;&#x2F;github.com&#x2F;ivanproskuryakov&#x2F;Aisel" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ivanproskuryakov&#x2F;Aisel</a>.<p>Aisel based on principles of REST architecture combines two different and independent frameworks - Symfony2 with a robust PHP community and progressive AngularJS.
treve将近 10 年前
PHP is also a dependable, boring, but proven choice.
centrinoblue将近 10 年前
node.js &#x2F; LoopBack - super fast prototyping, flexible, open js&#x2F;json
评论 #9727756 未加载
评论 #9727752 未加载
altsang将近 10 年前
for <i>this</i> specific use case? Node.js using LoopBack.io. I&#x2F;O platform with a framework that was specifically designed for this use case, built on top of Express to save you time.
pcx将近 10 年前
You haven&#x27;t used Django Rest Framework yet! I am 90% confident you will love it ;).
thamizharasu将近 10 年前
Java with JAX-RS api (Jersey framework) is my choice. Very clean API
romanovcode将近 10 年前
Easy answer. C# WebApi
bradhe将近 10 年前
golang is my goto.