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