node-fred
Version:
Another nodejs wrapper for the st louis fed
60 lines (43 loc) • 1.41 kB
Markdown
[](https://github.com/pastorsj/node-fred/actions)
[](https://www.npmjs.com/package/node-fred)
[](https://coveralls.io/github/pastorsj/node-fred?branch=master)
A Fred2 API wrapper
[](https://research.stlouisfed.org/docs/api/fred/)
[](https://pastorsj.github.io/node-fred-api/)
```
npm install node-fred --save
```
```javascript
import Fred from 'node-fred';
const fred = new Fred(API_KEY);
function getCategory(categoryID) {
fred.categories
.getCategory(125)
.then((res) => {
console.log('Category', res);
})
.catch((err) => {
console.error('Error', err);
});
}
getCategory(125);
```
```javascript
import Fred from 'node-fred';
const fred = new Fred(API_KEY);
async function getCategory(categoryID) {
try {
const category = await fred.categories.getCategory(categoryID);
console.log('Category', res);
} catch (err) {
console.error('Error', err);
}
}
getCategory(125);
```