I recently got the Leaderboard API issue fixed, but now I'm encountering a new problem with express Querying. Specifically, I'm attempting to search for a specific Discord ID using quick.db as my database. I've included an excerpt of my express.js code below that successfully searches for Different Ban Evidences by ID on another project.
https://website.com/api/levelstats?id=DISCORDID
When I input the Discord ID into the above URL, it should process the URL and display the desired result in an Object: https://i.stack.imgur.com/WDe5j.png
app.get("/api/levelstats", async function(request, response) {
response.setHeader('Content-Type', 'application/json');
if (!request.query.id) return response.send('null');
let data;
if (request.query.id !== 'all') data = await db.fetch('60Levelings', {
target: request.query.id
});
else data = await db.fetch('60Levelings');
if (!request.query.id !== 'all' && data) data.code = qs.parse(data.code).raw;
response.send(JSON.stringify(data));
})
I attempted a different approach using params, but without success. Any assistance would be greatly appreciated. Thank you.