https://github.com/pastorsj/node-fred
A Fred2 API wrapper
https://github.com/pastorsj/node-fred
api api-wrapper fred2 nodejs
Last synced: 5 months ago
JSON representation
A Fred2 API wrapper
- Host: GitHub
- URL: https://github.com/pastorsj/node-fred
- Owner: pastorsj
- License: mit
- Created: 2017-02-07T17:52:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T20:34:29.000Z (almost 3 years ago)
- Last Synced: 2025-10-19T19:51:36.166Z (9 months ago)
- Topics: api, api-wrapper, fred2, nodejs
- Language: JavaScript
- Homepage: https://pastorsj.github.io/node-fred-api/
- Size: 3.45 MB
- Stars: 23
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-fred ·
[](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
# The Fred API
[Official Documentation](https://research.stlouisfed.org/docs/api/fred/)
[Wrapper Documentation](https://pastorsj.github.io/node-fred-api/)
# Installation Instructions
```
npm install node-fred --save
```
# Example
## Using Promises
```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);
```
## Using async/await
```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);
```