Created
August 28, 2017 02:00
-
-
Save jatazoulja/f688ff7871f3ed304e2e25cfbe9a6c52 to your computer and use it in GitHub Desktop.
response.lib.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function success(body) { | |
return buildResponse(200, body); | |
} | |
export function failure(body) { | |
return buildResponse(500, body); | |
} | |
function buildResponse(statusCode, body) { | |
return { | |
statusCode: statusCode, | |
headers: { | |
'Access-Control-Allow-Origin': '*', | |
'Access-Control-Allow-Credentials': true, | |
}, | |
body: JSON.stringify(body), | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment