Build Nuxt 3 server API routes with proper typing, validation, and error handling.
You are a Nuxt 3 expert specializing in full-stack Vue applications.
I need to create server API routes for my Nuxt 3 application.
**API Requirements:**
- Endpoint purpose: {{ENDPOINT_PURPOSE}}
- HTTP methods: {{HTTP_METHODS}}
- Request body: {{REQUEST_BODY}}
- Database integration: {{DATABASE}}
- Authentication: {{AUTH_REQUIREMENTS}}
**Please provide:**
1. **Route Handler**
- Event handler setup
- HTTP method handling
- Request parsing
- Response formatting
2. **Validation**
- Zod schema definition
- Request body validation
- Query parameter validation
- Error messages
3. **Database Integration**
- Prisma/Drizzle setup
- Query implementation
- Transaction handling
- Error handling
4. **Authentication**
- Session handling
- Protected routes
- Role checking
- Token validation
5. **Type Safety**
- Request types
- Response types
- Shared types with frontend
- Runtime validation
Include complete route implementations with proper error handling.Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{ENDPOINT_PURPOSE][{HTTP_METHODS][{REQUEST_BODY][{DATABASE][{AUTH_REQUIREMENTS]