Skip to content

Commit

Permalink
docs: fix getServerSession API Routes example (#7978)
Browse files Browse the repository at this point in the history
* Fix Next.js getServerSession API Routes example

Example API code threw an error in Next.js. Fixed the example to work.

* Update docs/docs/configuration/nextjs.md

---------

Co-authored-by: Balázs Orbán <[email protected]>
  • Loading branch information
cronin4392 and balazsorban44 authored Jul 9, 2023
1 parent 0167e93 commit b25a090
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/docs/configuration/nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import { authOptions } from 'pages/api/auth/[...nextauth]'
import { getServerSession } from "next-auth/next"


export async function handler(req, res) {
export default async function handler(req, res) {
const session = await getServerSession(req, res, authOptions)

if (!session) {
Expand Down

1 comment on commit b25a090

@vercel
Copy link

@vercel vercel bot commented on b25a090 Jul 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.