Manipulating Data and Code Reuse

2019.05.25

Developing this twtxt registry server has been a great learning experience. I've been able to explore a really pleasant third-party HTTP multiplexer library called gorilla/mux, which, among other nice things, incorporates regex path validation directly within the path declarations when setting up the routing.

It's also been a great experience taking third-party data, the twtxt status files, and parsing it while handling all the edge cases. As soon as I began dumping garbage data (piped straight out of /dev/random) into the various functions, a whole host of bugs started to reveal themselves. Had I not taken this step, I probably wouldn't have found those bugs until much later.

Soon after starting the registry server project, I realized that the functions describing the direct handling of twtxt file data could potentially be useful to others, and so spun those off into their own repository as a library. Testing and debugging an isolated library was an experience in itself — I had to be very sure I was including various cases that a given function might come across. I then combined various tests into a mock registry server manipulating faked data, to be sure the registry functions acted appropriately. It was a lot of fun!

The two projects are located at: github.com/getwtxt

back