-
-
Save myszek123/6f181819073eb59566fb to your computer and use it in GitHub Desktop.
hook.io example microservice for using hook.io's cloud datastore API
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
module['exports'] = function datastoreExample (hook) { | |
var res = hook.res, | |
req = hook.req, | |
store = hook.datastore; | |
if (hook.params.ddd) { | |
store.set('mykey', { foo: hook.params.ddd }, function(err, result){ | |
if (err) { return res.end(err.message); } | |
return res.end("ok"); | |
}); | |
} else { | |
store.get('mykey', function(err, result){ | |
if (err) { return res.end(err.message); } | |
return res.end(JSON.stringify(result, true, 2)); | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment