Cleanup legacy files 🏂

pull/282/head
Amio 2019-06-03 19:33:00 +08:00
rodzic b4eea98f21
commit 1135a2bec3
3 zmienionych plików z 0 dodań i 34 usunięć

Wyświetl plik

@ -44,10 +44,6 @@ export function badgenServe (handlers: BadgenServeHandlers): Function {
color: 'grey'
}
// if (req.hostname === 'api.badgen.net') {
// return serveApi(req, res, { params })
// }
if (req.headers.host.startsWith('flat.') && query.style !== undefined) {
query.style = 'flat'
}

Wyświetl plik

@ -1,9 +0,0 @@
import { send } from 'micro'
const STALE_CONTROL = 'stale-while-revalidate=604800, stale-if-error=604800'
const CACHE_CONTROL = `public, max-age=20, s-maxage=120, ${STALE_CONTROL}`
export default async function serveApi (req, res, { params }) {
res.setHeader('Cache-Control', CACHE_CONTROL)
return send(res, 200, params)
}

Wyświetl plik

@ -1,21 +0,0 @@
const got = require('got')
const { send } = require('micro')
module.exports = async (req, res) => {
const [githubRateLimit] = await Promise.all([getGithubRateLimit()])
const memUsage = process.memoryUsage()
const cpuUsage = process.cpuUsage()
const stats = { githubRateLimit, memUsage, cpuUsage }
res.setHeader('Content-Type', 'application/json; charset=utf-8')
res.setHeader('Cache-Control', 'public, max-age=1, s-maxage=1')
send(res, 200, JSON.stringify(stats, null, 2))
}
const getGithubRateLimit = () => {
const url = 'https://api.github.com/rate_limit'
const token = process.env.GH_TOKEN
const headers = token && { Authorization: `token ${token}` }
return got(url, { json: true, headers }).then(res => res.body.resources)
}