When I make a gateway request to the URL manually in my project, it gives me the correct data, but when I try to send an http request with the frontend, the API does not work. Why is that?
JavaScript
<script>
document.getElementById("signupbtn").addEventListener("click",function(){
const username = document.getElementById("username").value;
const password = document.getElementById("password").value;
const xhr = new XMLHttpRequest();
xhr.open("POST","http://localhost:9000/user/register?username=${username}&password=${password}");
xhr.send();
})
</script>
Giving POST http://localhost:9000/user/register?username=${username}&password=${password} 400 (Bad Request)