Last active
May 14, 2017 20:18
-
-
Save dashersw/8bff619b27f88c861167bceb896da9d2 to your computer and use it in GitHub Desktop.
Hassle-free microservices with cote.js — conversion-service.js step 2
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 rates = { usd_eur: 0.91, eur_usd: 1.10 }; | |
responder.on('convert', (req, cb) => { // ideally, you would sanitize your input here. | |
cb(req.amount * rates[`${req.from}_${req.to}`]); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment