IntroducingFirst Post

Welcome to the Dangerzone

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:

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?

sub_header - c4341569-5831-4ccb-924f-16a387c68d66

"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.