emptygif
Harshe: Hausa

Duk harsuna da frameworks

Vercel Functions TypeScript

Snippet na TypeScript don Vercel Functions da ke amsa requests zuwa /pixel.gif da empty GIF, wanda ake decoding ɗinsa sau ɗaya lokacin farawa.

Vercel Functions TypeScript

Fayil
pixel.ts
Gudanar
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' },
  });
}

Mun compile ko mun duba types na wannan snippet.

Duba shi

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

Shafin hukuma: Vercel Functions

Ƙari a TypeScript