Gin: Static file not work

Created on 11 Apr 2017  路  1Comment  路  Source: gin-gonic/gin

Hi everyone.
I just set this

    router.StaticFS("/", http.Dir("./frontend/dist"))
    router.Static("/download", "./output")

but got error panic: path segment '/download/*filepath' conflicts with existing wildcard '/*filepath' in path '/download/*filepath' What wrong with me? Many thanks.

Most helpful comment

Solved by using middleware like router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true))) router.Use(static.Serve("/download", static.LocalFile("./output", true))) Notie import middleware first import "github.com/gin-gonic/contrib/static"

>All comments

Solved by using middleware like router.Use(static.Serve("/", static.LocalFile("./frontend/dist", true))) router.Use(static.Serve("/download", static.LocalFile("./output", true))) Notie import middleware first import "github.com/gin-gonic/contrib/static"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

windweller picture windweller  路  20Comments

libnat picture libnat  路  29Comments

elliotlings picture elliotlings  路  29Comments

TaceyWong picture TaceyWong  路  24Comments

dre1080 picture dre1080  路  25Comments