Skip to content
This repository was archived by the owner on Sep 25, 2018. It is now read-only.

Commit 9867061

Browse files
committed
add redirect
1 parent 6d788bf commit 9867061

File tree

3 files changed

+268
-3
lines changed

3 files changed

+268
-3
lines changed

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
#
55

66
all:
7-
go-bindata templates public
7+
go-bindata templates public/...
88
go build
9+
GOOS=windows GOARCH=386 go build
910

1011

1112
# vim:ft=make

bindata.go

+261
Large diffs are not rendered by default.

file-server.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ func restoreAssets() {
9090
selfDir := filepath.Dir(os.Args[0])
9191
for _, folder := range []string{"templates", "public"} {
9292
if _, err := os.Stat(folder); err != nil {
93-
if er := RestoreAssets(selfDir, "templates"); err != nil {
94-
log.Fatal(er)
93+
if er := RestoreAssets(selfDir, folder); er != nil {
94+
log.Fatal("RestoreAssets", er)
9595
}
9696
}
9797
}
@@ -106,6 +106,9 @@ func main() {
106106
// extract files
107107
restoreAssets()
108108

109+
m.Get("/", func(w http.ResponseWriter, r *http.Request) {
110+
http.Redirect(w, r, "/files/", http.StatusTemporaryRedirect)
111+
})
109112
m.Get("/files/**", func(req *http.Request, w http.ResponseWriter, params martini.Params, r render.Render) {
110113
path := params["_1"]
111114
if path == "" {

0 commit comments

Comments
 (0)