I have a home.html
spirit home.css
inside a templates
directory. I included the home.css
file in the home.html
file as:
<link href= "./home.css" rel = "stylesheet">
Now inside my main package
file, I have the following code:
package main
import(
"net/http"
"html/template"
"github.com/gorilla/mux"
)
func home(w http.ResponseWriter, r* http.Request){
temp , _ := template.ParseFiles("./templates/home.html")
temp.Execute(w, nil)
}
func main(){
router := mux.NewRouter()
router.HandleFunc("/",home)
http.ListenAndServe(":3000",router)
}
But I can not see the change in the website and when I checked the debugger console, I get the following errors:
The resource from “http://localhost:3000/home.css” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff).