17 lines
342 B
TypeScript
17 lines
342 B
TypeScript
// http://localhost:3000/api/car/1
|
|
|
|
import { PrismaClient } from "@prisma/client";
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const {id} = event.context.params;
|
|
|
|
const car = await prisma.car.findUnique({
|
|
where: {
|
|
id:parseInt(id)
|
|
}
|
|
});
|
|
return car;
|
|
}); |