好神奇的 async http 框架 --- Micro
发布于 8 年前 作者 Pana 4612 次浏览 来自 分享

第一次看 TJ 大神的 Koa 被惊的不行不行, koa 代码已经够少了, micro更少 100 来行. 而且全面拥抱 ES6 跟 async.

  • Easy. Designed for usage with async and await (more)
  • Fast. Ultra-high performance (even JSON parsing is opt-in).
  • Micro. The whole project is ~100 lines of code.
  • Agile. Super easy deployment and containerization.
  • Simple. Oriented for single purpose modules (function).
  • Explicit. No middleware. Modules declare all dependencies.
  • Standard. Just HTTP!

https://github.com/zeithq/micro

3 回复

没啥意思~

写一个

module.exports = function * (){
  this.body = 'hello world';
};

然后做个 cli, new 个koa app, use 一下这个generator function. 然后listen, 仅此而已…

  1. 论生态, micro 写的 await json, koa有更为强大的 body-parser, 其他类似…
  2. 论速度, micro说是 Standard. Just HTTP!, 我也是醉了, 你他妈都在服务端babel了, 然后拿自己是原生 http.createServer 说事

有感而发, 纯属吐槽~

"框架"几乎啥都没干,跟手写用 async/await 有啥区别。。。

@welefen 哈哈哈哈哈。皇帝的新衣啊。

回到顶部