next/server/api/bands/[id]/index.get.ts

9 lines
206 B
TypeScript

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();
return band;
});