Created
July 25, 2015 02:05
-
-
Save Marak/52090dad244f7e06065e to your computer and use it in GitHub Desktop.
hook.io example microservice for setting schema on hook parameter input
This file contains hidden or 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 inputSchema (hook, callback) { | |
// Responds back with incoming Hook parameters | |
hook.res.end(JSON.stringify(hook.params, true, 2)); | |
}; | |
// Specify an optional schema object | |
// This enables validation and defaults for Hook input | |
// For complete documentation on available schema types, | |
// see: http://github.com/mschema/mschema | |
module['exports'].schema = { | |
"name": { | |
"type": "string", | |
"default": "Bob", | |
"required": false | |
}, | |
"age": { | |
"type": "number", | |
"default": 40 | |
}, | |
"status": { | |
"type": "string", | |
"default": "active", | |
"enum": ["active", "disabled"] | |
}, | |
"isAlive": { | |
"type": "boolean", | |
"default": true | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment