Skip to content

Commit 4862332

Browse files
committed
start
1 parent c6c1f54 commit 4862332

11 files changed

+568
-131
lines changed

Database/handleDatabaseConnection.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { MongoClient } from "mongodb";
2+
//require('dotenv').config({path:'./env.local'});
3+
4+
const uri = process.env.DATABASE_URI;
5+
export const client = new MongoClient(uri);
6+
7+
export const connectDb = async()=>{
8+
try{
9+
await client.connect();
10+
console.log('connected');
11+
}catch(error){
12+
console.log('Error occured while connecting to database',error);
13+
}
14+
}

components/chat.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { signOut } from "next-auth/react";
2+
3+
export default function Chat({data}){
4+
return(
5+
<div className="bg-white flex text-black items-center min-h-screen justify-center">
6+
<h1> hi {data.user.name}</h1>
7+
<img src={data.user.image} className="rounded-full border-2 w-12 h-12" alt={data.user.name + ' photo'} />
8+
<button onClick={()=>signOut({callbackUrl:'/'})}>sign out</button>
9+
</div>
10+
)
11+
}

0 commit comments

Comments
 (0)