How to create API routes in Nuxt?
javascript
// server/api/users/[id].ts
export default defineEventHandler(async (event) => {
const id = event.context.params.id;
return { id, name: "John" };
});
// Available at: /api/users/123Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.