emptygif
Lugha: Kiswahili

Lugha na framework zote

React Router (framework mode, ex-Remix) TypeScript

Kipande cha TypeScript kwa React Router (framework mode, ex-Remix) kinachojibu maombi ya /pixel.gif kwa empty GIF, ambayo husimbuliwa (decode) mara moja programu inapoanza.

React Router (framework mode, ex-Remix) TypeScript

Sakinisha
npx create-react-router@latest
Faili
pixel.ts
Endesha
npm run dev
// app/routes.ts:  route('/pixel.gif', 'routes/pixel.ts')
// app/routes/pixel.ts - a resource route: a loader and no default export.
const GIF = Uint8Array.from(atob('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), (c) => c.charCodeAt(0));

export function loader() {
  return 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: React Router (framework mode, ex-Remix)

Zaidi katika TypeScript