Error: Error: Column 'todo' cannot be null
http://localhost:8080/todos
{ "todo":"吃饭" }
{ "success": false, "message": "Error: Error: Column 'todo' cannot be null" }
The same code as the author, Why does the error message keep coming up?
I encountered the same problem. There is an error in the code for the POST section:
const body = await request.body();
should be
const body = await request.body().value;
Changing that fixed it for me. Wasted a lot of my time!
@Stokestack thank you for pointing this out, this tutorial was created using Deno version 1.0.2 & it has since been updated. I don't want to update it to new version code here because then people who are coming from the article https://www.freecodecamp.org/news/create-a-todo-api-in-deno-written-by-a-guy-coming-from-node/ will get confused to see conflicting code.
You're welcome. How about putting a comment in the code with the updated syntax then, right above or under the current one?
You're welcome. How about putting a comment in the code with the updated syntax then, right above or under the current one?
doing that now 👍 @Stokestack
A new section has been added in the README.me for this repository https://github.com/adeelibr/deno-playground#troubleshoot
Thanks for pointing this out @gaodun2016 @Stokestack