-
Each API method will take 2 optional parameters:
-
query
- Query parameters for the given request. Refer to this for the list of methods and their accepted parameters. Some methods may require this parameter (the APIs will throw a
400
error if a required parameter is missing).
- Query parameters for the given request. Refer to this for the list of methods and their accepted parameters. Some methods may require this parameter (the APIs will throw a
-
cb
- Optional error-first callback for your request.
-
-
Whether or not a callback is provided, the request will return a standard Promise, use whichever you prefer.
const nba = require('nba').default; nba.stats.allPlayers().then(res => { console.log(res) }); // this also works nba.stats.allPlayers(function(err, res) { if (err) { console.error(err); return; } console.log(res); }); // not sure why you'd do this, but it also works nba.stats.allPlayers((err, res) => { console.log(res) }).then(res => { console.log(res) });