Last active
July 15, 2021 12:44
-
-
Save codeBelt/8abb26bda956ac9ec43ee1fc8227216b to your computer and use it in GitHub Desktop.
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
import nextConnect from 'next-connect'; | |
const apiRoute = nextConnect({ | |
// Handle any other HTTP method | |
onNoMatch(req, res) { | |
res.status(405).json({ error: `Method '${req.method}' Not Allowed` }); | |
}, | |
}); | |
// Process a POST request | |
apiRoute.post((req, res) => { | |
res.status(200).json({ data: 'success' }); | |
}); | |
export default apiRoute; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment