Create a gist now

Instantly share code, notes, and snippets.

Embed
const http = require('http');
exports.handler = async (event, context) => {
// console.log('Received event:', JSON.stringify(event, null, 2));
return new Promise((resolve, reject) => {
try {
const options = {
host: 'ec2-18-191-89-162.us-east-2.compute.amazonaws.com',
path: '/api/repos/r1639420d605/index?delta=true&clear=false',
port: 8000,
method: 'PUT'
};
const req = http.request(options, (res) => {
resolve('Success');
});
req.on('error', (e) => {
console.error(`problem with request: ${e.message}`);
reject(e.message);
});
// send the request
req.write('');
req.end();
} catch (err) {
console.log(err);
reject(err);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment