[Vuejs]-Applying changes for Vue application executed by GO

0👍

You can use vue with any backend. Seems like FileServer or your browser caches your static files. You could use Cache-Control: no-cache header to avoid caching.

0👍

The .vue source files must be processed in order to be served as HTML by a web server. You cannot modify .vue files and expect to see the changes in a web browser running against a production web server. As such, after modifications you must run npm run build which will process the .vue files and generate valid HTML files into /dist.

Now reviewing your code, I see that you could further simplify it by doing this:

func main() {
    http.Handle("/static", http.FileServer(http.Dir("web-vue/dist/")))
    http.Handle("/", http.FileServer(http.Dir("web-vue/dist/")))
    http.ListenAndServe(":8080", nil)
}

Leave a comment