score:3

.post("/username", {
      username: document.getElementById("username").value,
})
.then((res) => {
     // JSON response is handled by a json() promises
     return res.json().then( (data) => console.log(data));
});

Related Query

More Query from same tag