diff --git a/app.js b/app.js index 5ab128e4b4..f01a8ca999 100644 --- a/app.js +++ b/app.js @@ -3,6 +3,19 @@ const app = express(); const port = process.env.PORT || 3001; app.get("/", (req, res) => res.type('html').send(html)); +app.post("/v5/oauth/token", async (req, res) => { + try { + const response = await fetch("https://api.pinterest.com/v5/oauth/token", { + method: "POST", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + body: new URLSearchParams(req.body) + }); + const data = await response.json(); + res.json(data); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}); const server = app.listen(port, () => console.log(`Example app listening on port ${port}!`));