Skip to content

Instantly share code, notes, and snippets.

@iampato
Created August 30, 2021 07:40
Show Gist options
  • Select an option

  • Save iampato/7fa167e7500f4287ba410df2c5379a92 to your computer and use it in GitHub Desktop.

Select an option

Save iampato/7fa167e7500f4287ba410df2c5379a92 to your computer and use it in GitHub Desktop.
Go serve react build dir
package main
import (
"log"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./build/index.html")
}
func main() {
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment