rx-micro — Reactive HTTP microservices
Built on-top of micro with RxJS6 instead of async/await.
npm i rx-micro
Create an index.js
file and export a function which accepts the standard http.IncomingMessage and http.ServerResponse parameters as well as an Rx Observable
:
module.exports = (req, res, request$) => {
return request$.pipe(mapTo('Hello world!'))
}
Like micro
, rx-micro
handles return values:
module.exports = () => 'Hello world!'
npx rx-micro