github.com/dbernstein1/tyk@v2.9.0-beta9-dl-apic+incompatible/event_handlers/sample/sample_event_handler.js (about) 1 // ---- Sample middleware creation by end-user ----- 2 var sampleHandler = new TykJS.TykEventHandlers.NewEventHandler({}); 3 4 sampleHandler.NewHandler(function(event, context) { 5 // You can log to Tyk console output by calloing the built-in log() function: 6 log("Running sample JSVM Handler") 7 8 /* The Event object: 9 { 10 "Type": "Event Typ Code", 11 "Meta": { 12 "Message": "MEvent descriptions", 13 "Path": "/{{api_id}}/{{path}}", 14 "Origin": "1.1.1.1:PORT", 15 "Key": "{{Auth Key}}", 16 "OriginatingRequest": "" // B64 Encoded Request in wire protocol 17 }, 18 "TimeStamp": "2015-01-15 17:21:15.111157073 +0000 UTC" 19 } 20 21 */ 22 23 return 24 }); 25 26 // Ensure init with a post-declaration log message 27 log("Sample JS event handler initialised");