aboutsummaryrefslogtreecommitdiff
path: root/index.go
diff options
context:
space:
mode:
Diffstat (limited to 'index.go')
-rw-r--r--index.go29
1 files changed, 0 insertions, 29 deletions
diff --git a/index.go b/index.go
deleted file mode 100644
index 10160ab..0000000
--- a/index.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package main
-
-import (
- "io/ioutil"
- "net/http"
- "text/template"
-)
-
-func init() {
- http.HandleFunc("/index", indexHandler)
-}
-
-var indextmpl = template.Must(template.ParseFiles("tmpl/root", "tmpl/index"))
-
-func indexHandler(w http.ResponseWriter, r *http.Request) {
- files, err := ioutil.ReadDir("data")
- if err != nil {
- http.Error(w, err.Error(), http.StatusInternalServerError)
- return
- }
- p := new(Page)
- for _, entry := range files {
- file := entry.Name()
- if !entry.IsDir() && file[0] != '.' {
- p.Pages = append(p.Pages, entry)
- }
- }
- p.render(w, indextmpl)
-}