ಎಲ್ಲಾ ಭಾಷೆಗಳು ಮತ್ತು ಫ್ರೇಮ್ವರ್ಕ್ಗಳು
Netlify Edge Functions TypeScript
/pixel.gif ಗೆ ಬರುವ ವಿನಂತಿಗಳಿಗೆ ಖಾಲಿ GIF ನೊಂದಿಗೆ ಉತ್ತರಿಸುವ, Netlify Edge Functions ಗಾಗಿ ಒಂದು TypeScript ಸ್ನಿಪೆಟ್; GIF ಅನ್ನು ಆರಂಭದಲ್ಲಿ ಒಮ್ಮೆ ಮಾತ್ರ ಡಿಕೋಡ್ ಮಾಡಲಾಗುತ್ತದೆ.
Netlify Edge Functions TypeScript
// netlify/edge-functions/pixel.ts (runs on Deno at the edge)
import type { Config } from '@netlify/edge-functions';
const GIF = Uint8Array.from(atob('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), (c) => c.charCodeAt(0));
export default () =>
new Response(GIF, {
headers: {
'Content-Type': 'image/gif',
'Content-Length': String(GIF.length),
'Cache-Control': 'no-store',
},
});
export const config: Config = { path: '/pixel.gif' };
ನಾವು ಈ ಸ್ನಿಪೆಟ್ ಅನ್ನು ರನ್ ಮಾಡಿ, ಅದು ಹಿಂತಿರುಗಿಸಿದ ಬೈಟ್ಗಳನ್ನು ಹೋಲಿಸಿದ್ದೇವೆ.
ಪರಿಶೀಲಿಸಿ
curl -sI http://localhost:8080/pixel.gif
ಅಧಿಕೃತ ಸೈಟ್: Netlify Edge Functions