How to do array parameters in prisma?

Viewed 235

How can I do querying like this in prisma?

http://localhost://3000/api/users?[param1]=[value1]&[param2]=[value2]&......

Or param1, param2....can be from different model

1 Answers

req.query is object that contain query string that enter in the url and you access with req.query

const age = req.query.param1;
const score = req.query.param2;

const users = await prisma.users.findMany ({
  where: {
    age  , 
    score
  }
});
Related