i am trying access parts of the url from a fastify server.
the url looks like this for example:
http://localhost:3001/query_tile/10/544/336
in the fastify server i need the values for z/x/y. i am trying to do something like this:
interface BodyType {
z : string
x : string
y : string
}
fastify.get('/query_tile/:z/:x/:y', async (request : FastifyRequest<{ Body: BodyType }>, reply) => {
const { z, x, y } = request.body;
console.log(z,x,y, request.body)
// ....
}
but in return i get this error message:
{"statusCode":500,"error":"Internal Server Error","message":"Cannot destructure property 'z' of 'request.body' as it is undefined."}
what would be the right way to access these values?
Thanks a lot!!