I'm trying to display a static page with Go. Go: Package main import "net / http" function main () {fs: = http.FileServer (http.Dir ("static / house")) Http: .handle ("/", fs) http.ListenAndServe (": 4747", zero)} directory: project / stable home Html edit.html project.go When I run it, the web page displays links to edit.html and home.html instead of displaying a static page from home.html is. What am I doing wrong. Is this the best way to serve files? I know that there are other ways like From the HTML / templates package, but I'm not sure what is the difference between each of these methods and when. Thanks! fancy main () {http.Handle ("/", http.FileServer (Http) .ir ("static")) http.ListenAndServe (": 4747", zero)} You do not need static / home , just Static . and when you do not have index.html in / static , the directory instead Content appears. Just change the name of...
Comments
Post a Comment