Added callback to the endpoint to deal with cross-origin issues