Created
March 24, 2024 23:47
-
-
Save hewigovens/efcdf0eb93ee493e339af1da2ccc47e3 to your computer and use it in GitHub Desktop.
Serving files
This file contains 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" | |
"log" | |
"net/http" | |
) | |
func main() { | |
fmt.Println("Serving files in the current directory on port 8080") | |
http.Handle("/", http.FileServer(http.Dir("."))) | |
err := http.ListenAndServe(":8080", nil) | |
if err != nil { | |
log.Fatal("ListenAndServe: ", err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment