Skip to content

Instantly share code, notes, and snippets.

@snambi
Last active July 6, 2023 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save snambi/36c9270644436fcd842752b83d511df3 to your computer and use it in GitHub Desktop.
Save snambi/36c9270644436fcd842752b83d511df3 to your computer and use it in GitHub Desktop.
Javascript Fetch

Javascript fetch

fetch('https://mydomain.com/path/to/resource/v1', 
  { method: 'POST', 
    headers: {'Content-Type': 'application/json'},
    body : JSON.stringify( { 'name': 'john' } )
  } 
 ).then( res => res.json() 
 ).then( console.log);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment