Created
June 7, 2017 09:02
-
-
Save keithwhor/88b19b3e2027bf6cfa72a68d1b33b0e8 to your computer and use it in GitHub Desktop.
Node.js StdLib Calling / Composition Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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