vue

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2018 License: MIT Imports: 3 Imported by: 1

README

go-vue-handler

Vue Router history mode with Golang

installation

go get -u github.com/ddo/go-vue-handler

usage

  • build vue app to get index.html and dist folder
  • serve it as a static folder with go server
  • all the static files must has extension

example

/
    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)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(publicDir string) http.Handler

Handler return a http.Handler that supports Vue Router app with history mode

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL