Last active
October 18, 2021 21:23
-
-
Save schiemon/260b0f51f8e3564d4ace88b97fcdc602 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 { NextApiRequest, NextApiResponse } from "next"; | |
import { withApiAuthRequired } from "@auth0/nextjs-auth0"; | |
import nc from "next-connect"; | |
// Secured api endpoint. | |
// Possible synergy between next-connect and withApiAuthRequired from nextjs-auth0. | |
const handler = withApiAuthRequired( | |
nc<NextApiRequest, NextApiResponse>() | |
.get( | |
(req: NextApiRequest, res: NextApiResponse) => { | |
// ... | |
} | |
) | |
.post( | |
(req: NextApiRequest, res: NextApiResponse) => { | |
// ... | |
} | |
) | |
); | |
export default handler; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment