2018-06-29 16:52:17 +00:00
|
|
|
const badgen = require('badgen')
|
|
|
|
|
|
|
|
function serveBadge (req, res, params) {
|
|
|
|
res.writeHead(200, {
|
|
|
|
'Content-Type': 'image/svg+xml;charset=utf-8',
|
2018-07-12 06:31:48 +00:00
|
|
|
'Cache-Control': 'public, max-age=360, s-maxage=86400'
|
2018-06-29 16:52:17 +00:00
|
|
|
})
|
2018-07-12 06:31:48 +00:00
|
|
|
res.end(badgen(params))
|
2018-06-29 16:52:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function serveListBadge (req, res, params) {
|
|
|
|
const { subject, status, color } = params
|
|
|
|
serveBadge(req, res, { subject, status: status.replace(/,/g, ' | '), color })
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
serveBadge,
|
2018-06-29 17:34:06 +00:00
|
|
|
serveListBadge
|
2018-06-29 16:52:17 +00:00
|
|
|
}
|