-
-
Save DanyF-github/7b09e5992e97d33059d80924cc078184 to your computer and use it in GitHub Desktop.
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
// server/src/services/vonage/vonage.js | |
// import the npm package | |
const Vonage = require('@vonage/server-sdk'); | |
// import the Vonage credentials from the environment variables | |
const { vonageApiKey : apiKey, vonageApiSecret : apiSecret } = require('../../util/envs'); | |
// define the Vonage client | |
let instance = null; | |
const getVonageClient = () => { | |
// if the client is not already define then initialize it | |
if (!instance) { | |
instance = new Vonage({ | |
apiKey, | |
apiSecret | |
}); | |
} | |
// return the client | |
return instance | |
} | |
// export the function | |
module.exports = { | |
getVonageClient | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment