A static file server in Go language
A simple file server in Go. Just compile it and run binaries
//file_serve.go
package main
import "net/http"
func main() {
http.Handle("/", http.FileServer(http.Dir("./")))
error := http.ListenAndServe(":9000", nil)
if error != nil {
panic(error)
}
}
Compile it
go build file_serve.go
It will compile it to machine binaries
Then you can run server in any directory using that binary
Written by Bagwan Pankaj
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Static
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#