emptygif
भाषा: हिन्दी

सभी भाषाएँ और फ़्रेमवर्क

Vercel Functions TypeScript

Vercel Functions के लिए TypeScript स्निपेट, जो /pixel.gif पर आने वाली रिक्वेस्ट का जवाब empty GIF से देता है। GIF स्टार्टअप पर एक ही बार डिकोड होता है।

Vercel Functions TypeScript

फ़ाइल
pixel.ts
चलाएँ
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' },
  });
}

हमने इस स्निपेट को कंपाइल या टाइप-चेक किया।

जाँचें

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

आधिकारिक साइट: Vercel Functions

TypeScript में और