강의와 동일한 방식으로 util/database.js에 mongodb 연결 코드 작성하고
import { connectDB } from '@/util/database'
export default async function Home() {
const client = await connectDB;
const db = client.db("forum")
let res = await db.collection('post').find().toArray()
console.log(res);
return (
<>
<div>안녕</div>
</>
)
}
page.js (버전이 다른건지 제껀 index.js로 되어있습니다)에 위 코드 작성후 실행하였을때
이렇게 에러가 나옵니다.
nodejs 재설치 해보았고 node_module 삭제후 다시 설치 해보았는데 계속 이렇게 나옵니다 ㅠㅠ