I use prisma as ORM to build my expressJs API and when i try to fetch something, like a user below i have an empty JSOn as result. I don't understand because prisma has good access to my MySQL database (it mapped it well).
`
// route "/users"
app.get('/users/getAll', async (req,res)=>{
const users = prisma.user.findMany();
res.send(users);
});
`
I tried to use differents methods on differents table and i have the same result an empty JSON
CodePudding user response:
I think you're missing an await
const users = await prisma.user.findMany();
https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#findmany