emptygif
Dil: Türkçe

Tüm diller ve framework'ler

Fresh TypeScript

Fresh için, /pixel.gif isteklerine başlangıçta bir kez çözülen boş GIF ile yanıt veren bir TypeScript örneği.

Fresh TypeScript

Kurulum
deno run -Ar jsr:@fresh/init
Dosya
main.ts
Çalıştır
deno task dev
// main.ts - a programmatic route (Fresh 2)
import { App } from 'fresh';
import { decodeBase64 } from 'jsr:@std/encoding/base64';

const GIF = decodeBase64('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');

export const app = new App()
  .get('/pixel.gif', () =>
    new Response(GIF, {
      headers: { 'Content-Type': 'image/gif', 'Cache-Control': 'no-store' },
    }))
  .fsRoutes();

Bu örneği çalıştırıp döndürdüğü baytları karşılaştırdık.

Kontrol et

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

Resmî site: Fresh

TypeScript için daha fazlası