Created
February 9, 2017 04:25
-
-
Save crizstian/ac4a6ee5775f604e158d4cdeda757442 to your computer and use it in GitHub Desktop.
Example of a stripe charge
This file contains hidden or 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 { createContainer, asValue } = require('awilix') | |
const stripe = require('stripe') | |
// here we include the stripeSettings | |
function initDI ({serverSettings, dbSettings, database, models, stripeSettings}, mediator) { | |
mediator.once('init', () => { | |
mediator.on('db.ready', (db) => { | |
const container = createContainer() | |
container.register({ | |
database: asValue(db), | |
validate: asValue(models.validate), | |
ObjectID: asValue(database.ObjectID), | |
serverSettings: asValue(serverSettings), | |
// and here we register our stripe module | |
stripe: asValue(stripe(stripeSettings.secret)) | |
}) | |
mediator.emit('di.ready', container) | |
}) | |
// more code ..., check the cinema microservice repository for to see the full code | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment