A minimalistic, single-module, dependency-less two-directory Web server in Go.
I wanted a no-frills Web server to act as a repository librarian for a small set of Lua scripts written for an OpenComputers environment. Virtual "robots" in MC, running a very bare-bones wget knockoff, will be interacting with this server.
Specific requirements:
- A landing page (to provide the other URLs);
- Serve directory listings and files from two directories
lib
andupl
; - Upload files to
upl
(but notlib
); - Accept single-line "log" messages and display them in the server's log.
Go's standard packages provide enough scaffolding for a simple Web server from a single source module. This code does exactly what I want (modulo the ToDos), nothing more and nothing less, and I can control its feature set.
The LICENSE is MIT, which means that anyone can do whatever they want with the code.
SECURITY WAS NOT CONSIDERED IN THIS SOFTWARE so it might have (unintended!) security issues.
As a result, I recommend you don't use it in a security-critical environment.
Two files you may be interested in:
- The source, tiny-go-server.go
- The binary, tiny-go-server, for Linux X86-64 only.