Skip to content

Instantly share code, notes, and snippets.

@sackeyjason
Created May 4, 2020 19:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sackeyjason/cf80b58374e9a6e9e5f597c616c3eab7 to your computer and use it in GitHub Desktop.
CORS solution
exports.handler = async function http(req) {
return {
body: '{ "ok": true }',
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
"Access-Control-Allow-Headers":
req.headers["access-control-request-headers"],
},
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment