This is a playground
to test code. It runs a full Node.js
environment and already has all of npm
’s 1,000,000+ packages pre-installed, including akamai-nginx
with all npm
packages installed. Try it out:
require('babel-polyfill');
var akamaiNginx = require('akamai-nginx');
var fs = require('fs');
// example using local json. use setApiConfig for papi calls
akamaiNginx.setLocalConfig(
require.resolve('akamai-nginx/sample.papi.json'),
'./akamai.lua' // output file
);
// map values such as origin hostnames
akamaiNginx.setValueMap(
new Map([
['staging-old.akamai.com', 'staging-new.akamai.com'],
['origin.akamaicustomer.com', 'something.com']
])
);
// behaviours to skip altogether
akamaiNginx.setSkipBehaviors([
'cpCode'
]);
// do it
akamaiNginx.generateConf().then(function() {
var conf = fs.readFileSync('./akamai.lua');
console.log(conf);
console.log('done.');
});
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.