开源Nodejs微服务项目推荐:micro
发布于 2 个月前 作者 i5ting 1560 次浏览 来自 分享

https://github.com/zeithq/micro

Micro — Async HTTP microservices

Features

  • 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!

Example

The following example sleep.js will wait before responding (without blocking!)

import { send } from 'micro';
import sleep from 'then-sleep';
export default async function (req, res) {
  await sleep(500);
  send(res, 200, 'Ready!');
}

To run the microservice on port 3000, use the micro command:

$ micro -p 3000 sleep.js

点评

  • 技术栈比较潮,es7的async/await,性能会很好
  • 遵循node的小而美哲学
  • 文档,测试,代码都比较规范

在微服务架构的潮流里,是一个不错的选择

全文完

欢迎关注我的公众号【node全栈】

node全栈.png

如果想参与评论,请点击原文链接,进入国内最专业的cnode论坛

13 回复

micro webservice,赞

不错不错,很迷你

这跟手动用 ES6/7 特性写有啥区别。。。

我用express 写async await 然后babel一下不是更好?

@i5ting 嗷嗷, 原来这里已经分享了, 刚看到

回到顶部