Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat(http-api): add joi validation to bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire authored and daviddias committed Sep 30, 2016
1 parent 8509199 commit 028a98c
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/http-api/routes/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict'

const Joi = require('joi')
const resources = require('./../resources')

module.exports = (server) => {
Expand All @@ -20,7 +21,14 @@ module.exports = (server) => {
pre: [
{ method: resources.bootstrap.add.parseArgs, assign: 'args' }
],
handler: resources.bootstrap.add.handler
handler: resources.bootstrap.add.handler,
validate: {
query: {
arg: Joi.string().required(),
default: Joi.boolean(),
'stream-channels': Joi.boolean()
}
}
}
})

Expand All @@ -39,7 +47,14 @@ module.exports = (server) => {
pre: [
{ method: resources.bootstrap.rm.parseArgs, assign: 'args' }
],
handler: resources.bootstrap.rm.handler
handler: resources.bootstrap.rm.handler,
validate: {
query: {
arg: Joi.string().required(),
default: Joi.boolean(),
'stream-channels': Joi.boolean()
}
}
}
})
}

0 comments on commit 028a98c

Please sign in to comment.