Skip to content

Instantly share code, notes, and snippets.

@palmerabollo
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save palmerabollo/907d4a6cc19cd260b9c4 to your computer and use it in GitHub Desktop.

Select an option

Save palmerabollo/907d4a6cc19cd260b9c4 to your computer and use it in GitHub Desktop.
My first hook.io microservice
module['exports'] = function saveExternalIp (hook) {
var params = hook.params;
var store = hook.datastore;
var obj = { ip: params.ip, date: new Date() };
store.set('externalip', obj, function(err, result) {
if (err) {
return res.end(err.message);
}
// See http://hook.io/docs#data for more information
hook.res.write(JSON.stringify(obj));
hook.res.end();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment