https://github.com/garystafford/nasa-api-module
Node.js Module to access NASA's public APIs.
https://github.com/garystafford/nasa-api-module
api api-gateway aws lambda nodejs parameter-store serverless
Last synced: about 1 year ago
JSON representation
Node.js Module to access NASA's public APIs.
- Host: GitHub
- URL: https://github.com/garystafford/nasa-api-module
- Owner: garystafford
- Created: 2018-01-05T20:46:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-18T02:45:11.000Z (about 8 years ago)
- Last Synced: 2023-08-05T02:22:55.720Z (over 2 years ago)
- Topics: api, api-gateway, aws, lambda, nodejs, parameter-store, serverless
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NASA API Request Module
Node.js Module to access NASA's public APIs.
Requires your own personal [NASA API Key](https://api.nasa.gov/index.html#apply-for-an-api-key).
## Usage
Add to `package.json`
To install module from your private npm repository
```bash
npm install nasa-api-module
```
```text
{
"dependencies": {
"nasa-api-module": "^1.0.19"
}
}
```
To install module from the existing GitHub project
```text
{
"dependencies": {
"nasa-api-module": "github:garystafford/nasa-api-module#semver:1.0.19"
}
}
```
Add to JavaScript file
```javascript
const nasa = require('nasa-api-module');
return new Promise((resolve, reject) => {
nasa.getAstronomyPicOfDay((err, body) => {
if (err) {
return reject(err)
}
return resolve(body)
})
})
```
## Publish Module to Nexus
Update `package.json`
```json
{
"version": "1.0.19"
}
```
```bash
# commit changes
git add -A && git commit -m "Updating release version" && git push
# tag
git tag -a 1.0.19 -m "1.0.19"
git push --tags
# publish
npm login --registry=http://localhost:8081/repository/npm-group
npm publish # my registry is hard-coded in package.json
```
## AWS Parameter Store
Modules uses `cacheClient.js` from [theburningmonk/lambda-config-demo](https://github.com/theburningmonk/lambda-config-demo) GitHub repo, to access my personal NASA API Key from my AWS [Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html). My AWS Region is currently hard-coded in `cacheClient.js`, to hack around the following error: `ConfigError: Missing region in config AWS`.