Skip to content

Instantly share code, notes, and snippets.

@jeffreyaven
Created February 5, 2023 21:43
Show Gist options
  • Save jeffreyaven/f0e6c21b256a9fa72cb40d9f09084a8d to your computer and use it in GitHub Desktop.
Save jeffreyaven/f0e6c21b256a9fa72cb40d9f09084a8d to your computer and use it in GitHub Desktop.
const handler = async (event: Event) => {
...
try {
...
await logRequest(pageName, jwtId, event);
...
const data = ...;
return {
statusCode: 200,
body: JSON.stringify(data),
headers: ...,
};
} catch (error) {
...
if (err.message === 'Unauthorized') {
statusCode = 401;
}
return {
statusCode: statusCode,
headers: ...,
};
}
};
export { handler };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment