Puberty commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// +build binassets
|
||||
|
||||
package assets
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
assetfs "github.com/elazarl/go-bindata-assetfs"
|
||||
)
|
||||
|
||||
func Handler() http.Handler {
|
||||
// Following functions would be defined in bindata_assetfs.go during the
|
||||
// build process
|
||||
return http.FileServer(&assetfs.AssetFS{
|
||||
Asset: reactRouter,
|
||||
AssetDir: AssetDir,
|
||||
AssetInfo: AssetInfo,
|
||||
Prefix: "/",
|
||||
})
|
||||
}
|
||||
|
||||
func reactRouter(path string) ([]byte, error) {
|
||||
reactPrefixes := []string{"cmd", "jobs", "users"}
|
||||
for _, prefix := range reactPrefixes {
|
||||
if strings.HasPrefix(path, prefix) {
|
||||
return Asset("index.html")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Asset(path)
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// +build !binassets
|
||||
|
||||
package assets
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Handler() http.Handler {
|
||||
return http.NotFoundHandler()
|
||||
}
|
||||
Reference in New Issue
Block a user