add stripe and promises

This commit is contained in:
AJ ONeal 2017-05-29 17:32:44 +00:00
parent 41ca197500
commit a379a3c201
1 changed files with 5 additions and 0 deletions

View File

@ -155,6 +155,8 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
console.log('DEBUG pkgPath', pkgPath);
myApp = express();
myApp.handlePromise = require('./lib/common').promisableRequest;
myApp.handleRejection = require('./lib/common').rejectableRequest;
var _getOauth3Controllers = pkgDeps.getOauth3Controllers = require('oauthcommon/example-oauthmodels').create(
{ sqlite3Sock: xconfx.sqlite3Sock, ipcKey: xconfx.ipcKey }
@ -222,6 +224,9 @@ module.exports.create = function (xconfx, apiFactories, apiDeps) {
}
});
req.Stripe = require('stripe')(siteConfig['stripe.com'].live.secret);
req.StripeTest = require('stripe')(siteConfig['stripe.com'].test.secret);
req._walnutOriginalUrl = req.url;
// "/path/api/com.example/hello".replace(/.*\/api\//, '').replace(/([^\/]*\/+)/, '/') => '/hello'
req.url = req.url.replace(/\/api\//, '').replace(/.*\/api\//, '').replace(/([^\/]*\/+)/, '/');