Vue Router history mode with Golang
go get -u github.com/ddo/go-vue-handler
- build vue app to get
index.html
anddist
folder - serve it as a static folder with go server
- all the static files must has extension
/
public/
dist
index.html
server.go
package main
import (
"net/http"
"github.com/ddo/go-vue-handler"
)
const (
port = "8080"
publicDir = "./public"
)
func main() {
server := &http.Server{
Addr: ":" + port,
Handler: vue.Handler(publicDir),
}
err := server.ListenAndServe()
panic(err)
}