Tutorials
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.
-
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!
-
Create a
bundle.json
file that contains metadata for the EdgeWorkers function. -
Create a code bundle to compress the
.main.js
andbundle.json
files into a.tgz
file.
tar -czvf filename.tgz main.js bundle.json
-
Activate the version, see Manage EdgeWorkers.
-
Use the EdgeWorkers CLI to update the results for the most popular search terms via a scheduled task.
Updated 9 months ago