@netacea/akamai
v6.1.33
Published
Netacea Akamai CDN Integration
Downloads
557
Readme
Netacea Akamai
@netacea/akamai
is a package designed to add Netacea functionality to Akamai.
In this readme you will find guidance on implementation and validity checking.
Installation
Note: it is recommended to follow these installation instructions using NodeJs version 18.x
.
🌻 Starting fresh
Quickest way to get started, is pulling the Netacea Akamai template repository from github and following the steps in there to get up and running.
git clone [email protected]:Netacea/akamai-edgeworker-template-typescript.git
Follow the README.md
in the akamai-edgeworker-template-typescript repository to get this deployed.
✍ Existing Edgeworker
Run the following command to install the netacea worker
npm i @netacea/akamai --save
Require (javascript) or import (typescript) the worker
import NetaceaAkamai, { AkamaiConstructorArgs } from '@netacea/akamai'
Then declare a variable for the worker.
const worker = new NetaceaAkamai({})
Then register the two functions to be fired on the events onClientRequest and onClientResponse
export async function onClientRequest (request: EW.IngressClientRequest): Promise<void> {
await worker.requestHandler(request)
}
export async function onClientResponse (
request: EW.IngressClientRequest,
response: EW.EgressClientResponse
): Promise<void> {
await worker.responseHandler(request, response)
}
Akamai does not provide some crytography functions that are required by the integration. In order for the sample integration to work we have included these in the rollup config of the edgeworker template.
Akamai does provide some functionality that should be imported into your code bundle. These need to be included in the main.js bundled file in the following way:
import { httpRequest } from 'http-request';
import { logger } from 'log';
A number of property variables are required, including API key and Secret key. Instructions on how to set these can be found in the akamai-edgeworker-template-typescript