emptygif
भाषा: मराठी

सर्व भाषा आणि फ्रेमवर्क

Fresh TypeScript

Fresh साठी TypeScript स्निपेट, जो /pixel.gif वरच्या रिक्वेस्टना empty GIF ने उत्तर देतो. GIF स्टार्टअपला एकदाच डिकोड होतो.

Fresh TypeScript

इन्स्टॉल
deno run -Ar jsr:@fresh/init
फाइल
main.ts
चालवा
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();

आम्ही हा स्निपेट चालवला आणि त्याने परत केलेले बाइट्स तुलना करून पाहिले.

तपासा

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

अधिकृत साइट: Fresh

TypeScript मध्ये आणखी