Skip to content

Instantly share code, notes, and snippets.

@scottlepp
Created June 8, 2018 15:46
Show Gist options
  • Save scottlepp/0a12873095336c9cc1f0fa296c3581ef to your computer and use it in GitHub Desktop.
Save scottlepp/0a12873095336c9cc1f0fa296c3581ef to your computer and use it in GitHub Desktop.
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