0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Updated members api to use middleware exposed

no-issue
This commit is contained in:
Fabien O'Carroll 2019-09-25 14:21:00 +07:00
parent 11e246a93a
commit ab18905c76
2 changed files with 4 additions and 4 deletions

View file

@ -18,9 +18,9 @@ module.exports = function setupMembersApiApp() {
const siteUrl = new URL(urlUtils.getSiteUrl()); const siteUrl = new URL(urlUtils.getSiteUrl());
apiApp.use(cors(siteUrl.origin)); apiApp.use(cors(siteUrl.origin));
// Set up the api endpoints and the gateway
// NOTE: this is wrapped in a function to ensure we always go via the getter // NOTE: this is wrapped in a function to ensure we always go via the getter
apiApp.use((req, res, next) => membersService.api(req, res, next)); apiApp.post('/send-magic-link', (req, res, next) => membersService.api.middleware.sendMagicLink(req, res, next));
apiApp.post('/create-stripe-checkout-session', (req, res, next) => membersService.api.middleware.createCheckoutSession(req, res, next));
// API error handling // API error handling
apiApp.use(shared.middlewares.errorHandler.resourceNotFound); apiApp.use(shared.middlewares.errorHandler.resourceNotFound);

View file

@ -18,9 +18,9 @@ module.exports = function setupMembersApiApp() {
const siteUrl = new URL(urlUtils.getSiteUrl()); const siteUrl = new URL(urlUtils.getSiteUrl());
apiApp.use(cors(siteUrl.origin)); apiApp.use(cors(siteUrl.origin));
// Set up the api endpoints and the gateway
// NOTE: this is wrapped in a function to ensure we always go via the getter // NOTE: this is wrapped in a function to ensure we always go via the getter
apiApp.use((req, res, next) => membersService.api(req, res, next)); apiApp.post('/send-magic-link', (req, res, next) => membersService.api.middleware.sendMagicLink(req, res, next));
apiApp.post('/create-stripe-checkout-session', (req, res, next) => membersService.api.middleware.createCheckoutSession(req, res, next));
// API error handling // API error handling
apiApp.use(shared.middlewares.errorHandler.resourceNotFound); apiApp.use(shared.middlewares.errorHandler.resourceNotFound);