emptygif
Wika: Filipino

Lahat ng language at framework

Fresh TypeScript

Isang TypeScript snippet para sa Fresh na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.

Fresh TypeScript

I-install
deno run -Ar jsr:@fresh/init
File
main.ts
Patakbuhin
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();

Pinatakbo namin ang snippet na ito at ikinumpara ang mga byte na ibinalik nito.

Suriin

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

Opisyal na site: Fresh

Iba pa sa TypeScript