hono icon indicating copy to clipboard operation
hono copied to clipboard

Honojs shows 404 Not Found in Postman on app.delete() route with sqlite db

Open techwebdocs opened this issue 3 years ago • 2 comments

I have used the url in Postman is http://localhost:3000/user/1 on my local bun server. In case id 1 already exists in database. My Code: app.delete("/user/:id", async (c)=> { const id = await c.req.param('id'); console.log(id); db.run("DELETE FROM users WHERE id=?",id); return c.json({message: 'Deleted'}); });

but other routes are working well.

techwebdocs avatar Aug 01 '22 02:08 techwebdocs

Hi @techwebdocs

This error occurred by this bug of Bun. https://github.com/oven-sh/bun/issues/677

The only one thing that we can do is wait to fix the bug.

yusukebe avatar Aug 01 '22 09:08 yusukebe

hey! you can move the delete verb to the url in the middletime

app.post("/user/:id/delete", async (c)=> {
const id = await c.req.param('id');
console.log(id);
db.run("DELETE FROM users WHERE id=?",id);
return c.json({message: 'Deleted'});
});

fernandolguevara avatar Aug 16 '22 21:08 fernandolguevara

This seems to be closed.

yusukebe avatar Sep 26 '22 12:09 yusukebe