The go language implements one of the simplest instances of an http file server
- 2020-05-26 09:19:57
- OfStack
This article illustrates how the go language implements one of the simplest http file servers. Share with you for your reference. The specific implementation method is as follows:
package main
import (
"net/http"
)
func main() {
http.Handle("/", http.FileServer(http.Dir("./")))
http.ListenAndServe(":8123", nil)
}
I hope this article has been helpful to your programming of Go language.