what is the appropriate way to link the images and CSS files to html files which used as APIs using golang
I tried the following code but the CSS and images did't render , I used the julienschmidt library for routing the APIs
var tpl *template.Template
func init() {
tpl = template.Must(template.ParseGlob("*.html"))
}
func main(){
router := httprouter.New()
router.GET("/", indexPage)
}
func indexPage(w http.ResponseWriter, r *http.Request, _ httprouter.Params){
tpl.ExecuteTemplate(w, "index.html", nil)
}
in index.html I use the link to use external CSS file
<link rel="stylesheet" type="text/css" href="public/css/main.css" />
the file structures are
/go
/src
/github.com
/My_account
/WebServerProject
-main.go
-index.html
/public
/css
-main.css
/images