import { connectDB } from "@/util/database"
import { getServerSession } from "next-auth";
import { authOptions } from "../auth/[...nextauth]";
export default async function handler(요청, 응답) {
let session = getServerSession(요청, 응답, authOptions); //로그인된 유저 정보 기준으로 글 작
console.log(session);
if (session) {
요청.body.author = session.user.email;
}
console.log(요청.body)
if (요청.method == "POST") {
const db = (a
wait connectDB).db('forum');
let result = await db.collection('post').insertOne(요청.body);
응답.status(200).redirect('/list')
}
}
해당 오류가 발생하는데 이유가 뭘까요? 이전 예제까지는 이상없었어요