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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Koa – Next-generation web framework for Node.js

281 点作者 m0hit超过 11 年前

13 条评论

quarterto超过 11 年前
0s: &quot;next generation web framework for node.js&quot; (oh god, not another)<p>5s: &quot;designed by the team behind Express&quot; (wait what?)<p>6s: &quot;Through leveraging generators Koa allows you to ditch callbacks&quot; (wow, ok. oh hey, that makes &quot;next generation&quot; not just marketing fluff)<p>18s:<p><pre><code> app.use(function *(next){ var start = new Date; yield next; var ms = new Date - start; this.set(&#x27;X-Response-Time&#x27;, ms + &#x27;ms&#x27;); }); </code></pre> (oh sweeet)
评论 #6934806 未加载
评论 #6933766 未加载
评论 #6933838 未加载
评论 #6933777 未加载
评论 #6933764 未加载
spion超过 11 年前
Does koa (or co) solve the problem with generators where<p>* stack traces of errors are useless? [1]<p>* missing catch filters&#x2F;pattern matching i.e. catch (e) {} also captures type, reference and range errors i.e. &quot;pokemon exception handling&quot;?<p>[1]: <a href="http://spion.github.io/posts/analysis-generators-and-other-async-patterns-node.html#stack-trace-accuracy" rel="nofollow">http:&#x2F;&#x2F;spion.github.io&#x2F;posts&#x2F;analysis-generators-and-other-a...</a>
评论 #6936364 未加载
deif超过 11 年前
I have some questions about this:<p>1. The FAQ gives a political answer about the status of Express but I imagine that Express will not be actively maintained any more. Correct?<p>2. If focus is now on Koa, why the name change from Express when it is already a huge name for node frameworks?<p>3. If a new developer sees Express and Koa, would they immediately know which one is being focused on?<p>Basically I&#x27;m wondering why it couldn&#x27;t be called Express 3.0 (or 4.0).
评论 #6934143 未加载
评论 #6938617 未加载
评论 #6933903 未加载
评论 #6937302 未加载
zimbatm超过 11 年前
What&#x27;s the star in &quot;function *(){}&quot; for ?<p>EDIT: Answer: that&#x27;s how &quot;generator functions&quot; are recognized. <a href="http://wiki.ecmascript.org/doku.php?id=harmony:generators" rel="nofollow">http:&#x2F;&#x2F;wiki.ecmascript.org&#x2F;doku.php?id=harmony:generators</a>
评论 #6938325 未加载
评论 #6934467 未加载
turingbook超过 11 年前
Which Nodejs Web framework is the most popular in production? There are so many choices: <a href="http://nodeframework.com/" rel="nofollow">http:&#x2F;&#x2F;nodeframework.com&#x2F;</a><p>It seems Express and Connect? <a href="http://stackoverflow.com/questions/3809539/choosing-a-web-application-framework-using-node-js" rel="nofollow">http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;3809539&#x2F;choosing-a-web-ap...</a>
评论 #6936499 未加载
评论 #6936875 未加载
评论 #6936344 未加载
Sheepshow超过 11 年前
Not sure I understand the semantics. I&#x27;m passed what looks like a continuation, but instead of calling it, I yield it?<p>What other values can I yield, and why would I want to?<p>Alternatively, couldn&#x27;t the `next` object just be a plain continuation?
评论 #6937206 未加载
camus2超过 11 年前
If TJ is on board that&#x27;s the only information you need to know, you cant go wrong with any code that guy writes.
评论 #6935952 未加载
评论 #6933900 未加载
评论 #6934239 未加载
Kiro超过 11 年前
Can someone explain why this is better than for example Express?
评论 #6933986 未加载
评论 #6936528 未加载
oinksoft超过 11 年前
So much for &quot;above the fold.&quot;
评论 #6937273 未加载
rmrfrmrf超过 11 年前
It&#x27;s funny -- I love node.js for pretty much everything <i>except</i> for web frameworks. IMO Express, Koa, Sails, and Meteor are all lacking some kind of <i>je ne sais quoi</i>... maybe I should try my hand at one as an open source project...? Anyone have any good resources about framework design?
评论 #6940632 未加载
评论 #6937002 未加载
enen超过 11 年前
Does anyone have a good read on generators? I have no idea what that is.
评论 #6940580 未加载
rgbrgb超过 11 年前
If anybody finds &#x2F; does a benchmark, please link it here.
评论 #6945896 未加载
评论 #6936354 未加载
boultonmark超过 11 年前
yawn<p><a href="http://www.tornadoweb.org/en/stable/gen.html?highlight=generator" rel="nofollow">http:&#x2F;&#x2F;www.tornadoweb.org&#x2F;en&#x2F;stable&#x2F;gen.html?highlight=gener...</a>
评论 #6935490 未加载