How to delete this APİ?

I want to delete this data, but I failed.

Screenshot_1

What do you mean by removing the data? What do you actually want to remove? Would recommend looking here too: How do I ask a good question?

In case you just want to remove /api/client/illy you can just delete the line.

1 Like

data is not updated when I write another data on it

 client.on("message",async(message) => {
if(message.content !== "web!login") return  
 
app.get("/api/client/illy", (req, res) => res.status(200).end(message.author.username))

})

Maybe try using .send(yourdata) instead of .end(yourdata) to send the data to the user

1 Like

.end works the exact same as .send, that is none of the problems, except .end also ends the buffers and sends the data. .send will eventually call .end.

5 Likes

Never heard of .end() I thought it might of been a typo :joy: Very interesting, I will remember that! :slight_smile:

2 Likes

If I have got this right, after reading a little about it, you use .end if you want to end the response without any data, but you can put data in it anyway and it does the exact same thing as .send cause that calls .end anyway. Coding is so confusing :joy:

2 Likes

You can do something like:

const messages = new Collection();

client.on("message", message => messages.set(message.id, message));

app.get("/api/client/messages", (req, res) => res.end(JSON.stringify(messages.map(message => message.id))));
app.get("/api/client/messages/:id", (req, res) => res.end(JSON.stringify(messages.get(req.params.id))));
5 Likes