Created
February 3, 2025 08:05
-
-
Save colrdavidson/6cfd529af3d65bfd37b10269b38ee180 to your computer and use it in GitHub Desktop.
pop-up http server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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