emptygif
Dil: Türkçe

Tüm diller ve framework'ler

Azure Functions (Node.js v4 model) JavaScript

Azure Functions (Node.js v4 model) için, /pixel.gif isteklerine başlangıçta bir kez çözülen boş GIF ile yanıt veren bir JavaScript örneği.

Azure Functions (Node.js v4 model) JavaScript

Kurulum
npm i @azure/functions
Dosya
pixel.js
Çalıştır
func start
// src/functions/pixel.js
import { app } from '@azure/functions';

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

app.http('pixel', {
  methods: ['GET'],
  authLevel: 'anonymous',
  // Routes have no leading slash and sit under the "api" prefix unless
  // extensions.http.routePrefix is set to "" in host.json.
  route: '/pixel.gif'.slice(1),
  handler: async () => ({
    body: GIF,
    headers: {
      'Content-Type': 'image/gif',
      'Content-Length': String(GIF.length),
      'Cache-Control': 'no-store',
    },
  }),
});

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: Azure Functions (Node.js v4 model)

JavaScript için daha fazlası