server api useBody not working ?
Hi for me, the most simple example is not working: https://nuxt.com/docs/guide/directory-structure/server#handling-requests-with-body
Somehow the
body
is not received / read. Also I found out that $fetch
from the example should be changed to useFetch
... So my setup is this:
some component
my /api/newsletter/signup.post.js
anyone has any idea what I am doing wrong?4 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Hi, it's
readBody
, not useBody
. Did you get it to work?Thanks, I wasn't usign
useBody
as you can see in my example, I already figured this out. But still, nothing will be returned.
I am also experienceing debugging problems, for instance I change the code in my server/api
folder but I would not update, even after restarting the server. I am on nuxt 3.2.0
but had the same with 3.1.2
So I logged some things
newsletter.post.ts
Update: Ifound out this was because of my routeRules
in my nuxt.config.ts
…Interesting, so is this thread solved?