emptygif
Wika: Filipino

Lahat ng language at framework

Vercel Functions TypeScript

Isang TypeScript snippet para sa Vercel Functions na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.

Vercel Functions TypeScript

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

Kinompile o tinype-check namin ang snippet na ito.

Suriin

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

Opisyal na site: Vercel Functions

Iba pa sa TypeScript