A Cloudflare Worker that fetches the .gitignore templates from github/gitignore and caches them in Workers KV. I made it as the backend for gitignore-search, my Raycast extension.
Status: archived. Made in 2021, not maintained, and no longer deployed.
You'll need a Cloudflare account, a KV namespace and a GitHub token.
cp wrangler.toml.example wrangler.toml
wrangler kv:namespace create "GITIGNORES"
wrangler kv:namespace create "GITIGNORES" --preview
wrangler secret put OAUTH_TOKEN
wrangler devAdd your account ID (from wrangler whoami) and the two namespace IDs to wrangler.toml. The config and commands are for Wrangler 1, so a current Wrangler will need a rewritten config.
index.jsis the whole worker. A request to/returns the list of.gitignorefiles from the GitHub API. A request to/<Name>.gitignorereturns that file.- Responses are cached in the
GITIGNORESKV namespace for an hour.