Nectar of the Programming Masses
Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

node-sciencebase

0.0.1 • Public • Published

node-sciencebase

A USGS Science Base API

https://my.usgs.gov/confluence/display/sciencebase/ScienceBase

Install

$ git clone git@github.com:apburnes/node-sciencebase.git && cd node-sciencebase

$ npm install

Test

$ npm test

Example

// Note: Work in progress and not published to NPM
var sbClient = require('node-sciencebase');
 
var options = {};
 
// List all catalog items related to "water"
var searchQuery = {
  q = "water"
};
 
// Callback Style
sbClient(options).search(searchQuery, function(err, data) {
  if (err) {
    // handle error
  }
 
  // handle returned data
});
 
// Promise Style
sbClient(options).search(searchQuery)
  .then(function(data) {
    // handle data
  })
  .catch(function(err) {
    // handle err
  });

API

search(options, [callback]) => optional callback if used as a promise

Paramaters

  • options: Object, the query object
    • q: String, a string value to query science base
  • callback: Function, with a signature function(err, data)
    • err: Error
    • data: Object, object with response information
      • statusCode: Number, the request response status code
      • headers: Object, the request response headers
      • path: String, the request url path
      • body: Default JSON Object, the data returned from the sciencebase query

install

npm i node-sciencebase

Downloadsweekly downloads

2

version

0.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability