跳到主要内容
CNode

开源Nodejs微服务项目推荐:micro

分享
Ii5ting发布于 11 年前最后回复 10 年前
17184960

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论坛

查看回复

回复 (17)

L
leehomeok#1710 年前

nice

C
cuiyongjian#1610 年前

马克

C
CommanderXL#1510 年前

mark

X
xingtaowap#1410 年前

ES7。。

Y
yuu2lee4#1310 年前

先mark

N
ncuzp#1210 年前

mark

C
chengang4505#1110 年前

mark

Z
zstxt1989#1010 年前

好短小精悍

P
Pana#911 年前
引用 i5ting@Pana 哈哈

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

J
jiangzhuo#811 年前

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

W
welefen#711 年前

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

I
i5ting#611 年前

@Pana 哈哈

W
wangshaochun#511 年前

mark

X
XGHeaven#411 年前

不错不错,很迷你

Z
zkaip#311 年前

马克

R
reverland#211 年前

micro webservice,赞

E
ea7son#111 年前

mark

参与回复

登录后即可参与回复。登录