☙◦ The Tablet ❀ GamerGirlandCo ◦❧
ee7ea24e4e
change "bands" to "band" BREAKING CHANGE: breaks anything that tries to access `/api/bands/*`
17 lines
361 B
TypeScript
17 lines
361 B
TypeScript
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();
|
|
});
|