emptygif
Lugha: Kiswahili

Lugha na framework zote

Astro TypeScript

Kipande cha TypeScript kwa Astro kinachojibu maombi ya /pixel.gif kwa empty GIF, ambayo husimbuliwa (decode) mara moja programu inapoanza.

Astro TypeScript

Sakinisha
npm create astro@latest
Faili
pixel.ts
Endesha
npm run dev
// src/pages/pixel.gif.ts  (on-demand rendering needs a server adapter in production)
import type { APIRoute } from 'astro';

export const prerender = false;

const GIF = Uint8Array.from(atob('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), (c) => c.charCodeAt(0));

export const GET: APIRoute = () =>
  new Response(GIF, {
    headers: {
      'Content-Type': 'image/gif',
      'Content-Length': String(GIF.length),
      'Cache-Control': 'no-store',
    },
  });

Tuliendesha kipande hiki na kulinganisha baiti kilizorudisha.

Kagua

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

Tovuti rasmi: Astro

Zaidi katika TypeScript