Heyyy all, how can i get data between specifi date...
# random
a
Heyyy all, how can i get data between specifi dates with axios ? for example, i need a get data between 2019-11-01 and 2019-11-05 let startDate = "2019-12-01";     let endDate = "2019-12-05";     let url = `https://tmyaapiiehere.app/compras?date=${startDate}&date=${endDate}`; (editado)  can anyone send me a docs for read about how can do it ?? or send me a message please!!!
m
Copy code
prisma.yourmodel.findMany({
  where: {
   startDate: { gte: "2019-12-01" },
   endDate: { lte: "2019-12-05" ),
  }
})
Is tht what you're looking for?
a
Hey Maciek, thanks but not; i need do it with axios in node!!
m
But this is Prisma slack 🙂 Axios is just for fetching an endpoint. On that endpoint you would have the prisma call, right?
Copy code
axios.get('/apiEndpointWherePrismaCallIs', {  params: {
      startDate: startDate,
      endDate: endDate
    }
  }) })
Can you clarify more, so we can help?
It's been a long time since I did REST, but if you're using express then probably something like this:
Copy code
app.get(`/postEndpoint`, async (req, res) => {
  const { startDate, endDate } = req.body
  const result = await prisma.yourmodel.findMany({
  where: {
   startDate: { gte: startDate },
   endDate: { lte: endDate ),
  }
})
  res.json(result)
})
Is that what you mean?
Also you have two
date
in your url. You might want to correct that
a
Yeah thats that i need, but not with prisma only fetching a API to show the data between two dates