CNode

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

分享
Ii5ting发布于10 年前最后回复9 年前17 回复18455 浏览0 收藏

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)

X
xingtaowap#1·10 年前

ES7。。

C
CommanderXL#2·10 年前

mark

C
cuiyongjian#3·9 年前

马克

L
leehomeok#4·9 年前

nice

E
ea7son#5·10 年前

mark

R
reverland#6·10 年前

micro webservice,赞

Z
zkaip#7·10 年前

马克

X
XGHeaven#8·10 年前

不错不错,很迷你

W
wangshaochun#9·10 年前

mark

I
i5ting#10·10 年前

@Pana 哈哈

W
welefen#11·10 年前

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

J
jiangzhuo#12·10 年前

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

P
Pana#13·10 年前
引用 i5ting@Pana 哈哈

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

Z
zstxt1989#14·10 年前

好短小精悍

C
chengang4505#15·10 年前

mark

N
ncuzp#16·10 年前

mark

Y
yuu2lee4#17·10 年前

先mark

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