HTML文件中调用它后,我将React应用程序与Webpack捆绑在一起.但是,当我使用Golang和html / template查看HTML文件时,它会出错.

我的HTML文件:index.html

Note App

我的Golang文件:index.go

package main

import (

"net/http"

"html/template"

"path/filepath"

)

func handle(w http.ResponseWriter, r *http.Request) {

fp := filepath.Join("views", "index.html")

t := template.Must(template.ParseFiles(fp))

t.Execute(w, nil)

}

func main() {

http.HandleFunc("/", handle)

http.ListenAndServe(":8080", nil)

}