const user = await $fetch("/api/users", {
method: "POST",
body: {
name: "Cliford Pereira",
email: "clifordpereira@gmail.com",
bio: "Full-Stack Developer",
},
});
const users = await $fetch("/api/users");
const user = await $fetch("/api/users/1");
const updated = await $fetch("/api/users/1", {
method: "PATCH",
body: {
bio: "Updated bio",
},
});
await $fetch("/api/users/1", {
method: "DELETE",
});
Note: If authentication is enabled (default):
- Fullstack App: The module integrates with
nuxt-auth-utils, so session cookies are handled automatically.- Backend-only App: You must include the
Authorization: Bearer <token>header in your requests.