Created
April 22, 2020 02:12
-
-
Save alanmquach/4084a0c251728a0fbddc091e395e70ce to your computer and use it in GitHub Desktop.
POST JSON using fetch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const post = (url, body) => fetch(url, { | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json' | |
}, | |
method: "POST", | |
body: JSON.stringify(body) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment