All Topics
All Topics
Technology
Technology
AI
AI
Business
Business
Entertainment
Entertainment
News
News
Programming
Programming
Security
Security
Science
Science
Design
Design
Environment
Environment
Finance
Finance
Crypto
Crypto
Politics
Politics
Sports
Sports
Education
Education
Gaming
Gaming
Art
Art
Music
Music
Health
Health
Books
Books
Food
Food
Travel
Travel
Personal
Personal
Bluesky
Twitter

Workers for Platforms - Workers for Platforms now supports Static Assets

1y ago

Source

CloudflareWorkers for Platforms - Workers for Platforms now supports Static Assetscloudflare.com
Snippet from the RSS feed
Workers for Platforms customers can now attach static assets (HTML, CSS, JavaScript, images) directly to User Workers, removing the need to host separate infrastructure to serve the assets. This allows your platform to serve entire front-end applications from Cloudflare's global edge, utilizing caching for fast load times, while supporting dynamic logic within the same Worker. Cloudflare automatically scales its infrastructure to handle high traffic volumes, enabling you to focus on building features without managing servers. What you can build Static Sites: Host and serve HTML, CSS, JavaScript, and media files directly from Cloudflare's network, ensuring fast loading times worldwide. This is ideal for blogs, landing pages, and documentation sites because static assets can be efficiently cached and delivered closer to the user, reducing latency and enhancing the overall user experience. Full-Stack Applications: Combine asset hosting with Cloudflare Workers to power dynamic, interactive applications. If you're an e-commerce platform, you can serve your customers' product pages and run inventory checks from within the same Worker. JavaScript export default { async fetch ( request , env ) { const url = new URL ( request . url ) ; // Check real-time inventory if ( url . pathname === "/api/inventory/check" ) { const product = url . searchParams . get ( "product" ) ; const inventory = await env . INVENTORY_KV . get ( product ) ; return new Response ( inventory ) ; } // Serve static assets (HTML, CSS, images) return env . ASSETS . fetch ( request ) ; }, }; TypeScript export default { async fetch ( request , env ) { const url = new URL ( request . url ) ; // Check real-time inventory if ( url . pathname === '/api/inventory/check' ) { const product = url . searchParams . get ( 'product' ) ; const inventory = await env . INVENTORY_KV . get ( product ) ; return new Response ( inventory ) ; } // Serve static assets (HTML, CSS, images) return env . ASSETS . fetch ( request ) ; } }; Get Started: Upload static assets using the Workers for Platforms API or Wrangler. For more information, visit our Workers for Platforms documentation.

You might also wanna read

Comments

Sign in to join the conversation.

No comments yet. Be the first.