mercredi 28 février 2018

gin gonic css not being loaded from the root of the page

I have set my CSS folder to be a static resource like so:

r.Static("/css", "./css/")

And I have a webpage like this:

r.GET("/u/:pid/:id", handleUser)

However I'm having an issue where the HTML file for the user page "user.html" is loading the css as "css/main.css", however gin handles this request:

localhost:8080/u/0/2

where the CSS is loaded like this:

localhost:8080/u/0/css/main.css

my project structure is:

css/
    main.css
templates/
    user.html
main.go

Am I doing something glaringly wrong here?




Aucun commentaire:

Enregistrer un commentaire