This question already has an answer here:
by following the tutorial I try to connect the frontend (React) to backend api (Gin), but the static.Serve doesnt work, error prompted as below:
cannot use static.Serve("/", static.LocalFile("./views", true)) (type "github.com/gin-gonic/gin".HandlerFunc) as type "github.com/supebirdgz/amgmt/vendor/github.com/gin-gonic/gin".HandlerFunc in argument to router.Use
source:
import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/contrib/static"
)
func main() {
router := gin.Default()
router.Use(static.Serve("/", static.LocalFile("./frontend", true)))
router.Run()
}
if something updated in Gin ? i tried replace static package with others, still the same. Any idea about that ?
</div>