updated the index.js file to have a postMessage endpoint