Skip to content

A small web server customized for local testing of my blog

License

Notifications You must be signed in to change notification settings

telemachus/miniserve

Repository files navigation

miniserve: a small web server for local development

What?

miniserve is a small HTTP server for testing websites on a development computer. It doesn't do much, but it has a few features I wanted.

  • URLs don't require .html. For example, miniserve will look for basedir/pretty-url and, failing that, will try to serve basedir/pretty-url.html.
  • Structured logging via log/slog.
  • Graceful shutdown, as much as possible.
  • Optional flags can specify what port to serve on and what directory to serve. (The defaults are 8080 and ".".)

Why?

My website uses pretty URLs (i.e., no .html at the end). On the server, nginx takes care of all that, but I needed a way to test the site at home. Once upon a time, I wrote a very ugly solution, but it had no logging. I added logging using Gorilla, but Gorilla recently stopped being maintained. I took the opportunity to write a fuller and better—though still miniature—server.

To be honest, I wrote this largely as an excuse to learn things. It does what I need well, but I wouldn't recommend it for anything serious. I wouldn't even recommend it to anyone but me even for trivial things. That said, if you have suggestions or criticisms, please file an issue.

Credits

Thanks to the authors of the following for inspiration and (often) code.

About

A small web server customized for local testing of my blog

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published