emptygif
Lugha: Kiswahili

Lugha na framework zote

SvelteKit TypeScript

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

SvelteKit TypeScript

Sakinisha
npx sv create
Faili
+server.ts
Endesha
npm run dev
// src/routes/pixel.gif/+server.ts
import type { RequestHandler } from './$types';

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

export const GET: RequestHandler = () =>
  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: SvelteKit

Zaidi katika TypeScript