emptygif
Dil: Türkçe

Tüm diller ve framework'ler

Fastify JavaScript

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

Fastify JavaScript

Kurulum
npm i fastify
Dosya
server.mjs
Çalıştır
node server.mjs
import Fastify from 'fastify';

const GIF = Buffer.from('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==', 'base64');

const app = Fastify();

app.get('/pixel.gif', (request, reply) => {
  reply
    .type('image/gif')
    .header('Cache-Control', 'no-store')
    .send(GIF);
});

await app.listen({ port: 8080, host: '0.0.0.0' });

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: Fastify

JavaScript için daha fazlası