Skip to content

Instantly share code, notes, and snippets.

@johnnyman727
Created August 29, 2014 06:30
Show Gist options
  • Save johnnyman727/d28f55bac0c02b6a62da to your computer and use it in GitHub Desktop.
Save johnnyman727/d28f55bac0c02b6a62da to your computer and use it in GitHub Desktop.
Make a POST when Tessel's Config button is pressed.
var tessel = require('tessel'),
http = require('http');
var options = {
method : 'POST',
host : 'YOUR_HOST_HERE',
port : 'YOUR_PORT_HERE',
path : 'YOUR_PATH_HERE'
};
var data = 'YOUR_DATA_HERE';
// When the config button is pressed
tessel.button.on('press', function() {
// Create the request
var request = http.request(options, function(res) {
// Print out data when we get it
res.on('data', function(data) {
console.log('response data', data);
});
});
// Write any POST data
request.write(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment