我在我的index.js文件中有以下内容:
app.use(bodyParser.json());
但 Stripe Webhooks 要求如下:
将原始内容匹配为应用程序/json 格式
如果我将 index.js 更改为以下内容:
app.use(bodyParser.raw({type: 'application/json'}));
这是可行的。但是我所有其他的API路由将不再起作用。以下是我的路由:
router.route('/stripe-events')
.post(odoraCtrl.stripeEvents)
如何仅在此API路由中改变原始请求体?
apiRouter
和stripeEventsRouter
是什么意思?你能举个例子吗? - Vahid Najafi