rhjs
Version:
Request Helper
54 lines (38 loc) • 1.18 kB
Markdown
The **rhjs** library exported as Node.js modules.
This is a [Node.js](https://nodejs.org/en/) module available through the
[](https://www.npmjs.com/).
Before installing, [download and install Node.js](https://nodejs.org/en/download/).
Node.js 0.10 or higher is required.
Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```bash
$ npm install rhjs
```
```javascript
const express = require("express");
const rhjs = require("rhjs");
const app = express();
const port = 3000;
app.get("/", (req, res) => {
const success = result => {
console.log(result);
res.json(result);
};
const error = result => {
console.log(result);
res.json(result);
};
rhjs.get("https://jsonplaceholder.typicode.com/todos", success, error);
// res.send('empty data');
});
app.listen(port, () => console.log(`Example app listening on port ${port}!`));
```
To run the test suite, first install the dependencies, then run `npm test`:
```bash
$ npm install
$ npm test
```