如果您在提供静态文件,
/则无法按照https://github.com/julienschmidt/httprouter/issues/7#issuecomment-45725482提供其他路径
您不能在用于服务文件的根目录中注册“全部捕获”,而还要在子路径中注册其他处理程序。另请参见https://github.com/julienschmidt/httprouter#named-
parameters中的注释
您应该使用Go在应用程序根目录下提供模板,并在子路径下提供静态文件(CSS,JS等):
router := httprouter.New()router.GET("/", IndexHandler)// Ripped straight from the httprouter docsrouter.ServeFiles("/static/*filepath", http.Dir("/srv/www/public/"))http.Handle("/", router)


