emptygif
Language: English

All languages and frameworks

Vercel Functions TypeScript

A TypeScript snippet for Vercel Functions that answers requests for /pixel.gif with the empty GIF, decoded once at startup.

Vercel Functions TypeScript

File
pixel.ts
Run
vercel dev
// api/pixel.ts - served at /api/pixel; map /pixel.gif to it in vercel.json:
//   { "rewrites": [{ "source": "/pixel.gif", "destination": "/api/pixel" }] }
// (In a Next.js project use an App Router route handler instead.)
const GIF = Uint8Array.from(atob('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), (c) => c.charCodeAt(0));

export function GET() {
  return new Response(GIF, {
    headers: { 'Content-Type': 'image/gif', 'Cache-Control': 'no-store' },
  });
}

We compiled or type-checked this snippet.

Check it

curl -sI http://localhost:8080/pixel.gif

Official site: Vercel Functions

More in TypeScript