#RGRTHAT-webhook
1 messages · Page 1 of 1 (latest)
// needs raw body!
const webhook_route = require("./routes/webhook");
//
app.use(webhook_route, express.raw({ type: "*/*" }));
app.use(express.json());
// my other routes
let other_route = require("./routes/other_route")
app.use(other_route)
@vernal python Webhooks need raw body
but all my other routes need json parsing
so I need to somehow conditionally use the json parsing middleware, and the express.raw
but its not working
Is there a reason you're doing
app.use(webhook_route, express.raw({ type: "*/*" }));
instead of just
app.use('/webhook', express.raw({ type: "*/*" })); (not sure if "/webhook" is what your route is or it's something else, but you shouldn't be passing in the export into app.use)
Im passing the export for multiple other route files i have
when u pass the export, u pass all the routes in that file