Skip to content

Instantly share code, notes, and snippets.

@Marak
Last active June 18, 2016 04:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Marak/57408d6e745479c4a2d7 to your computer and use it in GitHub Desktop.
Save Marak/57408d6e745479c4a2d7 to your computer and use it in GitHub Desktop.
hook.io example microservice for using hook.io's cloud datastore API
module['exports'] = function datastoreExample (hook) {
var res = hook.res,
req = hook.req,
store = hook.datastore;
store.set('mykey', { foo: "bar" }, function(err, result){
if (err) { return res.end(err.message); }
store.get('mykey', function(err, result){
if (err) { return res.end(err.message); }
res.end(JSON.stringify(result, true, 2));
});
});
};
@ruffrey
Copy link

ruffrey commented Jul 30, 2015

j/w why not module.exports?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment