edgeworkers-examples icon indicating copy to clipboard operation
edgeworkers-examples copied to clipboard

Add example with jsdoc

Open jantimon opened this issue 4 years ago • 1 comments

It is possible to get full IDE support without setting up any transpilers.
Typescript supports .js files if they add the /// @ts-check comment and use JSDoc.

Maybe the following example would be a good reference for fast typesafe implementation without bundling/transpiling:

npm install --save-dev @types/akamai-edgeworkers
/// @ts-check
/// <reference types="akamai-edgeworkers" />

/**
 * @param {EW.ImmutableRequest & EW.HasRespondWith} request 
 * @param {EW.Response} response 
 */
export function onClientRequest(
  request,
  response
) {
  request.respondWith(
    200,
    {},
    "<html><body><h1>Hello World From Akamai EdgeWorkers</h1></body></html>"
  );
}

edge

jantimon avatar Nov 20 '20 15:11 jantimon

Hi @jantimon - sorry for the lag here. I'll look into this and get back with you. Seems like a logical suggestion.

dctheobald avatar Nov 24 '20 16:11 dctheobald