!TIP While the engine handles standard CRUD automatically, these same API endpoints can be consumed directly within your application whenever you need to implement custom logic or unique functionalities that go beyond basic data management.
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.