By generating JSON responses directly at the edge, this approach reduces the load on the origin server and improves response times. This is crucial for eCommerce platforms where quick data retrieval and responsiveness are critical for user satisfaction and conversion rates. This all impacts scaling growing eCommerce traffic without additional server load.
Loading...
https://www.edgecompute.live/edgeworkers/ecom/commerce-categories.html
Copied to clipboard!
This EdgeWorker tests for /commerce/categories in the URI path and responds to a GET parameter named search by running a case-insensitive regex against each title and description field, and a numeric comparison against each ID, returning an array of matching category entities, serialized as JSON. The response is generated at the Edge, so the origin server is not contacted, and the request is resolved at the first Edge server that answers it.
Improve Reliability
Move compute cycles to the edge, reducing load and improving reliability and performance of origin servers.
Reduce Latency
Speed up response times by moving work closer to users.
Related Examples
View More
Product URL Redirects
Note the URL path changing from /sku/483D5F/reviews to products/straight-fit-denim-jeans/reviews
This example uses EdgeWorkers + EdgeKV to extract a query string product SKU from an incoming URL, match it against a SKU stored in a KV database, and properly redirect the browser to the new product page.