首页 > Web开发 > 详细

[Node.js] Build microservices in Node.js with micro

时间:2017-01-26 22:20:41      阅读:282      评论:0      收藏:0      [点我收藏+]

micro is a small module that makes it easy to write high performance and asynchronous microservices in Node.js. This video will introduce you to micro by building a tiny service that responds to all requests.

 

const {send} = require(micro);
const sleep = require(then-sleep);

// Just send method
module.exports = (req, res) => {
    send(res, 200, Hello World!)
}

// Just use return
module.exports = (req, res) => {
    return Hello World return;
}

// Easy to use async await
module.exports = async function(req, res){
    await sleep(5000)
    send(res, 200, Ready!)
}

 

[Node.js] Build microservices in Node.js with micro

原文:http://www.cnblogs.com/Answer1215/p/6352105.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!