React Router (framework mode, ex-Remix) TypeScript
React Router (framework mode, ex-Remix) के लिए TypeScript स्निपेट, जो /pixel.gif पर आने वाली रिक्वेस्ट का जवाब empty GIF से देता है। GIF स्टार्टअप पर एक ही बार डिकोड होता है।
React Router (framework mode, ex-Remix) TypeScript
// app/routes.ts: route('/pixel.gif', 'routes/pixel.ts')
// app/routes/pixel.ts - a resource route: a loader and no default export.
const GIF = Uint8Array.from(atob('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='), (c) => c.charCodeAt(0));
export function loader() {
return new Response(GIF, {
headers: {
'Content-Type': 'image/gif',
'Content-Length': String(GIF.length),
'Cache-Control': 'no-store',
},
});
}
हमने यह स्निपेट चलाया और इसके लौटाए बाइट्स की तुलना की।
जाँचें
curl -sI http://localhost:8080/pixel.gif
आधिकारिक साइट: React Router (framework mode, ex-Remix)