Cloudflare Pages Functions TypeScript
Kipande cha TypeScript kwa Cloudflare Pages Functions kinachojibu maombi ya /pixel.gif kwa empty GIF, ambayo husimbuliwa (decode) mara moja programu inapoanza.
Cloudflare Pages Functions TypeScript
// functions/pixel.gif.ts (the file path is the route)
const GIF = Uint8Array.from(atob('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), (c) => c.charCodeAt(0));
export const onRequestGet: PagesFunction = () =>
new Response(GIF, {
headers: { 'Content-Type': 'image/gif', 'Cache-Control': 'no-store' },
});
Tuliendesha kipande hiki na kulinganisha baiti kilizorudisha.
Kagua
curl -sI http://localhost:8080/pixel.gif
Tovuti rasmi: Cloudflare Pages Functions