Files
shields/services/static-badge/query-string-static.service.js
chris48s 8621fe42d7 Upgrade Joi (#3505)
* upgrade joi
* find & replace ALL THE THINGS
* update related deps
2019-06-02 21:59:55 +01:00

29 lines
663 B
JavaScript

'use strict'
const Joi = require('@hapi/joi')
const { BaseStaticService } = require('..')
const queryParamSchema = Joi.object({
message: Joi.string().required(),
}).required()
module.exports = class QueryStringStaticBadge extends BaseStaticService {
static get category() {
return 'static'
}
static get route() {
return {
base: '',
pattern: 'static/:schemaVersion(v1)',
// All but one of the parameters are parsed via coalesceBadge. This
// reuses what is the override behaviour for other badges.
queryParamSchema,
}
}
handle(namedParams, queryParams) {
return { message: queryParams.message }
}
}