static-server: an HTTP server in Go for static content

I put together a simple static file server in Go - useful for local testing of web applications. Check it out at you have Go installed on your machine, you don't have to download anything else; you can run:$ go run And it will start serving the current directory! Run it with -help for usage information. No configuration files needed - the default is useful and you can adjust it to your needs using command-line flags.WhyWhen developing web applications locally, for basic test cases we can open an HTML file directly in the browser (using file:/// scheme). However, this is sometimes insufficient, and in several scenarios it's necessary to properly serve the HTML (along with its JS and CSS). Some cases where I encountered this are web applications that use at least one of:Web workersWeb socketsWASMSeparate API servers, requiring CORSIn the past, when I was more active in the Python ecosystem, I used python -m SimpleHTTPServer <port> quite a bit. Whi…
Related Topics: HTTP