ssg

node v10.20.1
version: 1.0.0
endpointsharetweet
var app = require('express')(); var axios = require("axios"); app.get("/*", async function(req,res) { var x = (await axios('https://api.github.com/repos/theabbie/theabbie.github.io/contents/blog/test.html')).data; axios({ method: 'put', url: 'https://api.github.com/repos/theabbie/theabbie.github.io/contents/blog/test.html', data: { "message": "my commit message", "committer": { "name": "abbie", "email": "[email protected]" }, "sha": x.data.sha, "content": Buffer.from((Buffer.from(x.data.content, 'base64').toString()+"hello").toString('base64') }, headers: { "Content-Type" : "application/vnd.github.v3+json", "Authorization" : "token " + process.env.github } }).then(function(m) { res.end(); }) }) app.listen(process.env.PORT);
Loading…

no comments

    sign in to comment