Skip to content

Instantly share code, notes, and snippets.

@ahndmal
Created January 23, 2022 08:12
Show Gist options
  • Save ahndmal/fd49f9875d5a619ab40200a00c5ad8f0 to your computer and use it in GitHub Desktop.
Save ahndmal/fd49f9875d5a619ab40200a00c5ad8f0 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func (w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Welcome to my website!")
})
fs := http.FileServer(http.Dir("static/"))
http.Handle("/static/", http.StripPrefix("/static/", fs))
http.ListenAndServe(":80", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment