Skip to content

Instantly share code, notes, and snippets.

@keithwhor
Created June 7, 2017 09:02
Show Gist options
  • Save keithwhor/88b19b3e2027bf6cfa72a68d1b33b0e8 to your computer and use it in GitHub Desktop.
Save keithwhor/88b19b3e2027bf6cfa72a68d1b33b0e8 to your computer and use it in GitHub Desktop.
Node.js StdLib Calling / Composition Example
const lib = require('lib');
// We deployed our dentist rating service as "dentists"...
// callback style
lib.user.dentists({ratings: [1, 2, 5, 5]}, (err, result) => {
// handle
});
// promise style
lib.user.dentists({ratings: [1, 2, 5, 5]})
.catch(err => /* error */)
.then(result => /* success */);
// async style
let result = await lib.user.dentists({ratings: [1, 2, 5, 5]});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment