Im new to this api but would like to use it for a route app

Im trying to add directions between one point and another but i only get the response that two points need to be specified while i think i did it the right way, searched on the issue but couldnt find a response so my bad in advance if theres a similar post already, here is my code i cant see where the fetch goes wrong

const query = new URLSearchParams({
profile: ‘foot’,
points: [
[longitude, latitude],
[55.60932713633075, 12.993716534967398]
],
key: mykey

      }).toString();

      fetch(`https://graphhopper.com/api/1/route?${query}`, { method: 'GET' })
        .then(resp => resp.json())
        .then(data => {
          if (data.paths && data.paths.length > 0) {
            const routeCoordinates = data.paths[0].points.coordinates.map(coord => L.latLng(coord[1], coord[0]));
            L.polyline(routeCoordinates, { color: 'blue' }).addTo(map); // Draw directions on the map
          } else {
            console.log(data);
            console.log("No directions found.");
          }
        })

It looks like you are using the wrong quotes in profile: 'foot'? Can you add a catch clause to the fetch, which error do you get?

You can only use JSON for the POST endpoint not in the URL like you try, I think. (or use our JS client)