beego-vue URL redirection

The specific process is not to say, it is to engage in this will naturally move, only the key code stickers.

 

Landv.cnblogs.com // 
// I do not authorized to reprint the content, do not put links, huh
package main import (
"routers" "github.com/astaxie/beego" "github.com/astaxie/beego/context" "net/http" "strings" ) func main() { ignoreStaticPath() beego.Run() } func ignoreStaticPath() { beego.InsertFilter("/",beego.BeforeRouter,TransparentStatic) beego.InsertFilter("/*",beego.BeforeRouter,TransparentStatic) } func TransparentStatic(ctx *context.Context){ orpath := ctx.Request.URL.Path beego.Info ( " Request url: " , orpath) // if the request contains the url field api described static resource redirection instruction should be canceled IF strings.Index (orpath, " api " )> = 0 { return } http.ServeFile (ctx.ResponseWriter, ctx.Request, " static / " + ctx.Request.URL.Path) // VUE compiled by the content goes here }

 

Guess you like

Origin www.cnblogs.com/landv/p/11075203.html