The EdgeWorkers service makes it possible for you to deploy JavaScript functions at the edge and create customized experiences for your website visitors. Like most serverless solutions, EdgeWorkers scripts are invoked at the four different phases of an HTTP request. This provides an opportunity to improve performance, by moving compute closer to your users. Using every edge server as a compute node also accelerates your development and deployment times by applying solutions on a massive scale across our entire, globally distributed, Intelligent Edge Platform.

Follow these steps to implement a serverless function, written in JavaScript. To do this, you'll create an EdgeWorkers code bundle.

  1. Create an EdgeWorker ID.

  2. Create a main.js file.

    Here are recipes for the JavaScript source code that include event handler functions for some of the most common EdgeWorkers implementations.


You can find more code samples in the EdgeWorkers GitHub repository. They are practical examples to use as a starting point for your ​Akamai​ EdgeWorkers. Feel free to use, modify, and extend!

  1. Create a bundle.json file that contains metadata for the EdgeWorkers function.

  2. Create a code bundle to compress the .main.js and bundle.json files into a .tgz file.
    tar -czvf filename.tgz main.js bundle.json

  3. Activate the version, see Manage EdgeWorkers.

  4. Use the EdgeWorkers CLI to update the results for the most popular search terms via a scheduled task.