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, , '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()
send(res, , 'Ready!')
}

[Node.js] Build microservices in Node.js with micro的更多相关文章

  1. [Docker] Build a Simple Node.js Web Server with Docker

    Learn how to build a simple Node.js web server with Docker. In this lesson, we'll create a Dockerfil ...

  2. 输入npm install 报错npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.13.1 postinstall: `node scripts/build.js`

    输入npm install 报以下错误 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.13.1 postinstall: ...

  3. sublime的js调试环境(基于node环境)

    很多的语言都有控制台,都要专门的ide,js,用sublime在node的环境下,可以配置console, 如何配置?首先,要有node的环境,下载安装,还要安装到c盘才行,然后找到'工具(tool) ...

  4. [转载]Node入门 » 一本全面的Node.js教程

    http://www.nodebeginner.org/index-zh-cn.html 作者: Manuel Kiessling 翻译: goddyzhao & GrayZhang & ...

  5. widows下node.js环境搭建及运行js

    昨天刚刚开始学习node.js,网上一些教程不是很清楚,所以总结一下我的经验. 1.安装. 安装省略,就到官网上去下载安装一下就好.安装完成之后,打开cmd,输入"path",查看 ...

  6. node.js和socket.io纯js实现的即时通讯实例分享

    在这个例子中,其实node.js并没有真正起到服务器的作用,因为我们这里可以直接运行client.html文件,而不用输入url请求,当 然,要想输入url请求页面内容还需要加入请求静态文件的代码.这 ...

  7. [Node.js] Exporting Modules in Node

    In this lesson, you will learn the difference between the exports statement and module.exports. Two ...

  8. node.js系列笔记之node.js初识《一》

    node.js系列笔记之node.js初识<一> 一:环境说明 1.1 Linux系统CentOS 5.8 1.2 nodejs v0.10.15 1.3 nodejs源码下载地址 htt ...

  9. node.js入门系列(一)--Node.js简介

    什么是NodeJS JS是脚本语言,脚本语言都需要一个解析器才能运行.对于写在HTML页面里的JS,浏览器充当了解析器的角色.而对于需要独立运行的JS,NodeJS就是一个解析器. 每一种解析器都是一 ...

随机推荐

  1. Robot Framework初步使用

    第一步,新建一个Project:

  2. bitmap-setBounds方法参数研究

    对于如下的代码,一直有点不明白它具体每一步操作的影响.今天就稍微研究下.代码如下 xml代码 <RelativeLayout xmlns:android="http://schemas ...

  3. 用jquery获取单选按钮选中的内容 和 获取select下拉列表选中的值

    1.<label><input name='reason' type='radio' value='您的评论内容涉嫌谣言' />您的评论内容涉嫌谣言</label> ...

  4. Docker---(6)问题:bash: vi: command not found

    原文:Docker---(6)问题:bash: vi: command not found 版权声明:欢迎转载,请标明出处,如有问题,欢迎指正!谢谢!微信:w1186355422 https://bl ...

  5. Day2:列表、元组

    一.列表 1.定义与访问元素(按索引) #!/usr/bin/env python # -*- coding:utf-8 -*- # Author:Hiuhung Wan list_a = [&quo ...

  6. mysql 配置,还得多看看~

    http://blog.chinaunix.net/uid-20639775-id-154429.html

  7. 参数传递方法(用Delphi的汇编代码解释)

    参数传递方法 李纬的InsideVCL<第一章>中提到Windows定义的回调函数 typedef LRESULT (CALLBACK*WNDPROC)(HWND,UNIT,WPARAM, ...

  8. 连接mongodb,kafka异步处理代码

    1. mongodb异步处理 依赖: <dependencies> <dependency> <groupId>org.mongodb</groupId> ...

  9. C#数据池

    //ThreadPool(线程池)是一个静态类,它没有定义任何的构造方法(),我们只能够使用它的静态方法,这是因为,这是因为ThreadPool是托管线程池(托管线程池http://msdn.micr ...

  10. NVL与NVL2

      一.NVL函数是一个空值转换函数   NVL(表达式1,表达式2)   如果表达式1为空值,NVL返回值为表达式2的值,否则返回表达式1的值. 该函数的目的是把一个空值(null)转换成一个实际的 ...