Simple file host

This commit is contained in:
rayaman 2025-08-18 17:42:13 -07:00
commit 967baa6aaf
2 changed files with 21 additions and 0 deletions

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module gitea.epicknes.ddns.net/epicknex/SimpleFileServer
go 1.24.2

18
main.go Normal file
View File

@ -0,0 +1,18 @@
package main
import (
"flag"
"log"
"net/http"
)
func main() {
port := flag.String("p", "8100", "port to serve on")
directory := flag.String("d", ".", "the directory of static file to host")
flag.Parse()
http.Handle("/", http.FileServer(http.Dir(*directory)))
log.Printf("Serving %s on HTTP port: %s\n", *directory, *port)
log.Fatal(http.ListenAndServe(":"+*port, nil))
}