I’m currently trying to make a webapp using Vercel’s postgresql data storage. However when I’m fetching my database since my backend the request takes too much time.
When I use the vercel tools in the data base directly, it’s working properly :
Whereas, when I have fetched the DB since my Express Backend the request takes an infinite amount of time…
router.get("/randomcard", async function (req, res, next) {
const client = await db.connect();
let data = await client.sql`SELECT * FROM Cards
ORDER BY RANDOM()
LIMIT 1;`;
console.log("Card selected from db : " + data.name);
res.set("Cache-Control", "no-store");
res.json(data);
await client.end();
});
I’m pretty sure I’m doing something wrong, so I hope someone will explain to me the issue ^^ Thanks.