Created
November 6, 2020 20:05
-
-
Save trezy/a7b7dd544c1ed5435d4df88dfafb9caf to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// pages/api/newsletter/signup.js | |
export default async function(request, response) => { | |
if (req.method !== 'POST') { | |
return response.status(405).end() | |
} | |
const { | |
email, | |
name, | |
} = request.body | |
try { | |
await functionThatSendsDataToTheNewsletterService() | |
} catch (error) { | |
response.status(500).end() | |
} | |
response.status(200).end() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment