EBDM.DEV / Blog

Hear about some of my mad ramblings.

So welcome one and all to the new home for my mad ramblings... here! I have been writing a fair amount for a number of years now but never really had the inclination to post them for all to see. So here it goes!

This blog has been built in NextJS and uses both Notion's new API and Firebase as a psuedo-CMS system. I am writing this in Notion, and when I finish it'll load up on the page, it feels like magic, the sweet power of APIs. Let's see if I can show you some of this code awesomeness:

javascript
import { Client } from "@notionhq/client"
const notion = new Client({
  auth: process.env.NOTION_TOKEN,
})

const database = {
	blog: "3a58bc30-8715-46d4-814f-ed9f777b2a72"
}

export default async function Posts(req, res) {
	const { results } = await notion.databases.query({
		database_id: database.blog,
	})
	const posts = await Promise.all(results.map(item => {
		return notion.blocks.children.list({block_id: item.id}).then(blocks => {
			const { results } = blocks;
			item.blocks = results;
			return item;
		})
	}));

  res.status(200).json(posts)
}

Huzzah! He's alive. This snippet pulls this post, along with all the others from notion. Running on a serverless function on Vercel, this throws the data back to the NextJS frontend which renders it using some botched css for your viewing pleasure. Let's give these embeds a little spin, shall we?

Well, I can create another heading if I so desire...

"To quote Shakespeare, or not to quote Shakespeare, that is the question"

Apparently this tweet I have embedded doesn't appear to be loading - I guess that's where this renderer draws the line... A bit of human ingenuity later and I have it solved! I built myself a new renderer... There goes a few hours of my life I'm not getting back 😅 Hey ho, at least I have a blog up now... Hopefully will point me in the right direction of actually writing a few things. Keep an eye out and sign up to the mailing list if you want to hear about more of my tinkering or mad ranting, whichever the weather dictates.