badgen.net/libs/serve-badge.js

20 wiersze
466 B
JavaScript
Czysty Zwykły widok Historia

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',
'Cache-Control': 'public, max-age=360, s-maxage=86400'
2018-06-29 16:52:17 +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
}