Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 742 Bytes

CONTRIBUTING.md

File metadata and controls

36 lines (26 loc) · 742 Bytes

Contribution Guide

Development Guide

git clone https://github.com/uetchy/badge-api.git && cd badge-api
npm install

npm i -g vercel
vc dev

Adding new badge

  1. Create file-system routes for new badge in api/
  2. Update README.md
  3. Create an pull request

File-system routes

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,
  };
});