import { messages } from "~/lib/server/constants"; import { Band } from "~/models/band"; export default eventHandler(async (ev) => { const id = parseInt(getRouterParam(ev, "id") as string); const band = await Band.findById(id).exec(); if (!band) { throw createError({ statusCode: 404, message: messages[404], }); } return band.toObject(); });