Cannot use body and headers with GET method, Solution 1 - Instead of GET method you can make the method as POST or PUT to send body and headers.
Solution 2 - If you want to send data with GET method you can send it as queryParams
const userDetails = { name: "john", email: "[email protected]", password: "1234", }
const queryParams = new URLSearchParams(userDetails).toString();
You can send queryParams in api url as
await fetch(`http://localhost:8001/user?${queryParams}`, {
method: "GET",
});
and receive it as req.query in backend