emptygif
Basa: Basa Jawa

Kabeh basa lan framework

Next.js (App Router) TypeScript

Snippet TypeScript kanggo Next.js (App Router) sing mangsuli request menyang /pixel.gif nganggo empty GIF, sing didekode sepisan nalika startup.

Next.js (App Router) TypeScript

Instal
npx create-next-app@latest
File
route.ts
Lakokake
npm run dev
// app/pixel.gif/route.ts
const GIF = Uint8Array.from(atob('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), (c) => c.charCodeAt(0));

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

Snippet iki wis dilakokake lan byte asile wis dibandhingake.

Priksa

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

Situs resmi: Next.js (App Router)

Liyane ing TypeScript