Write the hono post, fix up some styles and add a publishe on date.

This commit is contained in:
Dave Smith-Hayes 2024-08-11 21:39:56 -04:00
parent d1d9e45c47
commit 3f7981dd9c
3 changed files with 34 additions and 1 deletions

View File

@ -1,10 +1,11 @@
--- ---
title: Adventures with Bun and Hono title: Adventures with Bun and Hono
description: A blog post wherein I talk about building this blog with Bun and Hono. description: A blog post wherein I talk about building this blog with Bun and Hono.
date: 2024-08-01 date: 2024-08-11
tags: tags:
- development - development
- javascript - javascript
- typescript
- bun - bun
- hono - hono
slug: fullstack-hono slug: fullstack-hono
@ -223,4 +224,26 @@ sudo certbot revoke --cert-name davesmithhayes.com
At this time Let's Encrypt had rate-limited my many, many failed attempts to get a new certificate for my own domain. Time to wait it out. An hour to be exact. At this time Let's Encrypt had rate-limited my many, many failed attempts to get a new certificate for my own domain. Time to wait it out. An hour to be exact.
So, instead of actually waiting an hour I went to bed and waited for a few days to get back to work. I knew I had previously deployed a really basic Node.js application with Dokku, hence why I decided to keep using it as a platform to deploy applications on.
I realized that application was running, by default, on port `3000` and I think Dokku is expecting all the applications to run on `5000` by default. I can't seem to find any documentation on that but the moment I removed the following line from the `Dockerfile`:
```dockerfile
EXPOSE 3000
```
And set the application environment required an update to the `APP_PORT` envvar that I run the application on.
```shell
dokku config:set davesmithhayes.com APP_PORT=5000
```
_et voila_! Now I could set up certificates with Let's Encrypt and we are good to go.
## Conclusions
Its been a long time since I started and _finished_ a software project, on my time, and I am happy with. Using Hono and Bun, two technologies I am adjacently familiar with, was also a huge plus to me. I enjoyed it so much that I think this PHP project I have been hobbling together for the last couple of months will get a complete rewrite in TypeScript using Hono and Bun.
I really hope that you read this far and took something away about how to do projects on your own, how viable these technologies are, and how to have fun doing basic things. I don't think this blog would have required as much work as I had put into it, but I am happy that I did. Please [feel free to contact me](mailto:me@davesmithhayes.com) about my Bun and Hono experience.
That's it. I'm a convert. Praise Bun.

View File

@ -29,3 +29,8 @@ pre code.hljs {
border-radius: 5px; border-radius: 5px;
background-color: #fafafa; background-color: #fafafa;
} }
main .post-meta {
font-style: italic;
font-size: 12pt;
}

View File

@ -1,10 +1,15 @@
import { Post } from "@blog/models/Post"; import { Post } from "@blog/models/Post";
export function parseDate(date: Date): string {
return date.toISOString().slice(0,10);
}
export function PostPage({ post }: { post: Post }) { export function PostPage({ post }: { post: Post }) {
const html = { __html: post.html ?? '' }; const html = { __html: post.html ?? '' };
return ( return (
<> <>
<h1>{post.meta.title}</h1> <h1>{post.meta.title}</h1>
<div class="post-meta">Posted on {parseDate(post.meta.date)}</div>
<div class="post-content" dangerouslySetInnerHTML={html} /> <div class="post-content" dangerouslySetInnerHTML={html} />
</> </>
); );