import { mongoConnect } from "$lib/database/mongo"; export async function load({ params }) { const slug = params.slug; const db = await mongoConnect() const query = { slug: slug } const col = db.db('fredboniface').collection('posts') const res = col.findOne(query) const posts = await res // Create the `Article` object here and return that rather than doing it on the page. return {data: JSON.stringify(posts)} }