AWS Lambda (Node.js) JavaScript
AWS Lambda (Node.js) ਲਈ JavaScript ਸਨਿੱਪਟ, ਜੋ /pixel.gif ਦੀਆਂ ਬੇਨਤੀਆਂ ਦਾ ਜਵਾਬ ਖਾਲੀ GIF ਨਾਲ ਦਿੰਦਾ ਹੈ; GIF ਸ਼ੁਰੂਆਤ ’ਤੇ ਇੱਕ ਵਾਰ ਡੀਕੋਡ ਹੁੰਦੀ ਹੈ।
AWS Lambda (Node.js) JavaScript
// 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,
});
ਅਸੀਂ ਇਹ ਸਨਿੱਪਟ ਚਲਾਇਆ ਅਤੇ ਇਸ ਵੱਲੋਂ ਵਾਪਸ ਕੀਤੀਆਂ ਬਾਈਟਾਂ ਦੀ ਤੁਲਨਾ ਕੀਤੀ।
ਜਾਂਚੋ
curl -sI http://localhost:8080/pixel.gif
ਅਧਿਕਾਰਤ ਸਾਈਟ: AWS Lambda (Node.js)