Skip to content

Instantly share code, notes, and snippets.

@Madmals
Last active October 23, 2021 17:13
Show Gist options
  • Save Madmals/264d16182361143f118098ea6857d244 to your computer and use it in GitHub Desktop.
Save Madmals/264d16182361143f118098ea6857d244 to your computer and use it in GitHub Desktop.
FETCH POST METHOD ON GITHUB GIST
content = {
"description": "TITLE ",
"public": false,
"files":
{
"post1.md": {
"content": "THIS IS WHERE CONTENT WILL BE PUT"
}
}
}
const token = your access_token'
const githubgist = async ()=>{
let res = await fetch('https://api.github.com/gists',
{
headers: {'Authorization': `token ${token}`,
'Content-type': 'application/json'},
method:'post',
body:JSON.stringify(content)
})
let data = await (res.json())
console.log(data)
}
githubgist()

NOTES



content must include description public and files in object token from setting and developer in github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment