db connection

This commit is contained in:
isaconantonis 2023-08-02 11:23:37 +02:00
parent 6ba28a795c
commit 407016b57c
3 changed files with 17 additions and 15 deletions

View file

@ -1,11 +1,7 @@
import client from "../lib/mongodb";
import client from "../lib/mongodb"
export async function getTeamPlayers() {
const db = client.db("SloppyFuckers")
return await db.collection("players").find({}).toArray();
}
const db = client.db("portfolio")
export async function getEvents() {
const db = client.db("SloppyFuckers")
return await db.collection("events").find({}).toArray();
export async function getProjects() {
return await db.collection("projects").find({}).toArray()
}

View file

@ -1,4 +1,8 @@
export default function Web() {
import { getProjects } from "./actions"
export default async function Web() {
const projects = await getProjects()
return (
<section>
<div className="mx-auto grid max-w-screen-xl px-4 py-8 text-center lg:py-16">
@ -6,6 +10,14 @@ export default function Web() {
<h1 className="mb-4 max-w-2xl text-4xl font-extrabold leading-none tracking-tight md:text-5xl xl:text-6xl">
IsaCon
</h1>
{projects.map((project) => (
<div
key={project.id}
className="mb-4 max-w-2xl text-4xl font-extrabold leading-none tracking-tight md:text-5xl xl:text-6xl"
>
{project.name}
</div>
))}
</div>
</div>
</section>