API route errors
Have I structured this incorrectly?
I have a GET endpoint at
/api/department
and also e.g. a DELETE endpoint at /api/department/:id
. Calling these endpoints with $fetch
. I'm getting the error message that Type '"DELETE"' is not assignable to type '"get" | "GET" | undefined'
, which is due to the intellisense not seeing the catch-all routes.4 Replies
I'm just trying to build a normal REST API structure. Nothing fancy at all.
seems correct. But shouldn't it be [id].delete.ts?
Nuxt
server/ · Nuxt
The server/ directory is used to register API and server handlers to your application.
Hmm
But they do [...slug]
Thought it would be the same, but maybe not
Thanks! I went straight to #catch-all-route and missed the earlier section about named routes.