Skip to content

Commit

Permalink
Add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksTeresh committed Jul 22, 2024
1 parent 5a3a69c commit 6afd8fb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/server/routes/webhookProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ const axios = require("axios")
const router = require("express").Router()

router.get("/:webhookId", async (req, res) => {
console.log(req)
// only allow POST
if (req.method === "POST") {
const webhookUrl = `${process.env.DISCORD_WEBHOOK_URL}/${req.params.webhookId}/${process.env.DISCORD_WEBHOOK_TOKEN}`
const webhookData = req.body
try {
console.log('Sending webhook', webhookUrl, webhookData)
await axios.post(webhookUrl, webhookData, { params: req.query })
console.log('Webhook sent successfully')
res.status(200).send("Webhook sent successfully")
return
} catch (error) {
Expand Down

0 comments on commit 6afd8fb

Please sign in to comment.