Markdown server (Rust)
In a quest to take better notes, and organize my life, I’ve begun using a Zettelkasten method. The most common tool for this is Obsidian, which is quite good, but doesn’t integrate well with my preferred workflow. Notably:
- using neovim to edit and create files
- storing everything on my local server over VPN
To get closer to that goal, I wrote a webserver to browse files, and render markdown. This also provided a good project to learn how to program in Rust.
There are two implementations:
- Simple markdown server (archived) – very simple, implemented with a synchronous runtime and threadpool
- Hyper markdown server – implemented with an async runtime (tokio), and the hyper library for http requests.
The server provides:
- a full directory listing and browser
- rendering of markdown files
- support for images and pdf files
Because it was a learning exercise, I chose to use lower-level libraries rather than frameworks like Axum or Actix. The downside of not using a higher-level framework is that I don’t get easy access to middleware like authorization or tracing. However, this is intended to run locally with only get requests, so that’s fine for my purposes.