Skip to content

Instantly share code, notes, and snippets.

@shlomitc
Created June 21, 2016 14:09
Show Gist options
  • Save shlomitc/4b8dbe98a7271d2ffc2738b2efc32175 to your computer and use it in GitHub Desktop.
Save shlomitc/4b8dbe98a7271d2ffc2738b2efc32175 to your computer and use it in GitHub Desktop.
How to use the fetch api to send a json object
fetch('http://localhost:4000/generate',
{
method: "POST",
headers: {
"Content-type": "application/json; charset=UTF-8"
},
body: JSON.stringify({a:1})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment