¿Cómo probar la solicitud de publicación de back-end con jest y supertest?
Interfaz
fetch("http://localhost:8081/test", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ url }), }) .then((res) => res.json()) .then((result) => console.log(result) });back-end
app.post("/test", async (req, res) => { const url = req.body.url; const fullUrl = `https://api.meaningcloud.com/sentiment-2.1?key=${API_KEY}&url=${url}&lang=en`; const response = await fetch(fullUrl); const data = await response.json(); res.send(data); });