Skip to content

Instantly share code, notes, and snippets.

@colrdavidson
Created February 3, 2025 08:05
Show Gist options
  • Select an option

  • Save colrdavidson/6cfd529af3d65bfd37b10269b38ee180 to your computer and use it in GitHub Desktop.

Select an option

Save colrdavidson/6cfd529af3d65bfd37b10269b38ee180 to your computer and use it in GitHub Desktop.
pop-up http server
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
dir := os.Args[1]
fs := http.FileServer(http.Dir(dir))
http.Handle("/", http.StripPrefix("/", fs))
fmt.Println("Server started on port 8000")
http.ListenAndServe(":8000", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment