Get text files from __files__ dir

This commit is contained in:
Bel LaPointe
2020-07-23 23:21:43 -06:00
parent 461592ec40
commit bbdd4919ba
3 changed files with 94 additions and 1 deletions

View File

@@ -29,11 +29,15 @@ func jsonHandler(g storage.Graph) http.Handler {
path: "/who/",
foo: who,
},
{
path: config.New().FilePrefix,
foo: files,
},
}
for _, route := range routes {
path := route.path
nopath := strings.TrimRight(route.path, "/")
path := nopath + "/"
foo := route.foo
mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
if err := foo(g, w, r); err != nil {