Skip to content

Instantly share code, notes, and snippets.

@gansbrest
Created March 19, 2014 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gansbrest/9634417 to your computer and use it in GitHub Desktop.
Save gansbrest/9634417 to your computer and use it in GitHub Desktop.
var handleApiRequest = function(req, plugin, next) {
validate_path(req.path, function(err) {
if (err) {
var error = plugin.hapi.error.badRequest(err);
next(error);
}
});
next();
}
exports.register = function (plugin, options, next) {
// Api request parser and validator
plugin.ext('onPostAuth', function(req, extNext) {
reqHandlers.handleApiRequest(req, plugin, function(err) {
extNext(err);
});
});
next();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment