Files
shields/services/static-badge/query-string-static.service.js
Paul Melnikow 4f411755da Add a stats category for static badges (#3168)
Right now they're showing up in "other," though I expect they make up
most of that category.

https://github.com/badges/shields/issues/966#issuecomment-469851361
2019-03-05 21:23:20 -06:00

29 lines
657 B
JavaScript

'use strict'
const Joi = require('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 }
}
}