emptygif
Harshe: Hausa

Duk harsuna da frameworks

AWS Lambda (Node.js) JavaScript

Snippet na JavaScript don AWS Lambda (Node.js) da ke amsa requests zuwa /pixel.gif da empty GIF, wanda ake decoding ɗinsa sau ɗaya lokacin farawa.

AWS Lambda (Node.js) JavaScript

Fayil
index.mjs
// index.mjs - behind an API Gateway HTTP API route "GET /pixel.gif" or a function URL.
// Binary bodies travel base64-encoded, so the GIF stays in base64 here.
const GIF_BASE64 = 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';

export const handler = async () => ({
  statusCode: 200,
  headers: { 'Content-Type': 'image/gif', 'Cache-Control': 'no-store' },
  body: GIF_BASE64,
  isBase64Encoded: true,
});

Mun gudanar da wannan snippet kuma mun kwatanta bytes ɗin da ya mayar.

Duba shi

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

Shafin hukuma: AWS Lambda (Node.js)

Ƙari a JavaScript