From 6b4443ca74a1cc84ea1ed02ac1e55789cb6cb3fb Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Wed, 7 Jan 2015 11:23:25 +0100 Subject: [PATCH] Added longhand joi example. --- .../modules/org/arangodb/foxx/request_context.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/js/server/modules/org/arangodb/foxx/request_context.js b/js/server/modules/org/arangodb/foxx/request_context.js index e3077a85bc..f6ba9d4bd8 100644 --- a/js/server/modules/org/arangodb/foxx/request_context.js +++ b/js/server/modules/org/arangodb/foxx/request_context.js @@ -496,6 +496,21 @@ extend(RequestContext.prototype, { /// }); /// ``` /// +/// Using a joi schema: +/// +/// ```js +/// app.post("/foxx", function (req, res) { +/// var joiBody = req.parameters.joiBody; +/// // Do something with the number +/// }).bodyParam("joiBody", { +/// type: joi.number().integer().min(5), +/// description: "A number greater than five", +/// allowInvalid: false // default +/// }); +/// ``` +/// +/// Shorthand version: +/// /// ```js /// app.post("/foxx", function (req, res) { /// var joiBody = req.parameters.joiBody;