[Node.js] Build microservices in Node.js with micro
2023-09-14 08:59:18 时间
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!') }
相关文章
- 【nodejs原理&源码赏析(6)】深度剖析cluster模块源码与node.js多进程(下)
- [Node.js] Migration with Umzug
- [Node.js] Fetch csv data and parse
- [Node.js] Resolve path problem in all envs (require.resolve)
- [Tools] Convert SVG to a PDF in Node with PDFKit and SVG.js
- [Node.js] Read a File in Node.js with fs.readFile and fs.readFileSync
- [Node.js] Creating JWTs (JSON Web Tokens) in Node
- [Node.js] Use "prestart" in scripts
- node.js实现国标GB28181设备接入的sip服务器解决方案
- node-canvas遇到NODE_MODULE_VERSION不一致的问题
- [Node.js] Handle Relative Paths in a Node.js ESM Project with import.meta.url
- [Node.js] Show More Lines in a Node.js Error Stack Trace
- [Tools] Create a Simple CLI Tool in Node.js with CAC
- [Node.js] Trigger a File Download in Express
- [Node.js] Read a File in Node.js with fs.readFile and fs.readFileSync
- [Node.js] Write or Append to a File in Node.js with fs.writeFile and fs.writeFileSync
- [Node.js] Pass command line arguments to node.js
- [Node.js] Level 6. Socket.io
- [Node.js]33. Level 7: Persisting Questions
- 15 个常见的 Node.js 面试问题及答案
- 部署 Node.js 应用以完成服务器端渲染 Server Side Rendering 的性能调优
- Node.js(一)概述、全局对象/函数、node各模块使用介绍
- Node.js fs模块(三)目录操作