TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Koa – Next-generation web framework for Node.js

281 pointsby m0hitover 11 years ago

13 comments

quartertoover 11 years ago
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 未加载
spionover 11 years ago
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 未加载
deifover 11 years ago
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 未加载
zimbatmover 11 years ago
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 未加载
turingbookover 11 years ago
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 未加载
Sheepshowover 11 years ago
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 未加载
camus2over 11 years ago
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 未加载
Kiroover 11 years ago
Can someone explain why this is better than for example Express?
评论 #6933986 未加载
评论 #6936528 未加载
oinksoftover 11 years ago
So much for &quot;above the fold.&quot;
评论 #6937273 未加载
rmrfrmrfover 11 years ago
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 未加载
enenover 11 years ago
Does anyone have a good read on generators? I have no idea what that is.
评论 #6940580 未加载
rgbrgbover 11 years ago
If anybody finds &#x2F; does a benchmark, please link it here.
评论 #6945896 未加载
评论 #6936354 未加载
boultonmarkover 11 years ago
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 未加载