git clone https://github.com/uetchy/badge-api.git && cd badge-api
npm install
npm i -g vercel
vc dev
- Create file-system routes for new badge in
api/
- Update README.md
- Create an pull request
If you want your new badge location to be badge.vercel.app/foobar/:baz
, then create a file named [baz].ts
in api/foobar
.
import { makeBadge } from "../../../lib/badge";
import { json } from "../../../lib/fetch";
export default makeBadge(async ({ baz }) => {
const response = await json(`https://example.com/api?q=${baz}`);
return {
label: "foobar",
color: "magenta",
status: response.status,
};
});