diff --git a/main.go b/main.go index 4c3c743..22c730c 100644 --- a/main.go +++ b/main.go @@ -1,22 +1,12 @@ package main import ( + "Advertisement_Panel/src" "fmt" "html/template" "net/http" ) -type FileData struct { - ImageNames []string - SpicyImageNames []string - AsciiFiles []AsciiEntry -} - -type AsciiEntry struct { - Name string - FontSize int -} - var templ *template.Template func main() { @@ -27,7 +17,7 @@ func main() { http.HandleFunc("/", index_handler) // Serves json for html to find file names - http.HandleFunc("/files", file_handler) + http.HandleFunc("/files", src.FileHandler) // Serves ascii page http.HandleFunc("/ascii", ascii_handler) diff --git a/file_handlers.go b/src/FileHandlers.go similarity index 85% rename from file_handlers.go rename to src/FileHandlers.go index d593d0e..382c3a5 100644 --- a/file_handlers.go +++ b/src/FileHandlers.go @@ -1,4 +1,4 @@ -package main +package src import ( "encoding/json" @@ -10,8 +10,19 @@ import ( const staticDir = "static" +type FileData struct { + ImageNames []string + SpicyImageNames []string + AsciiFiles []AsciiEntry +} + +type AsciiEntry struct { + Name string + FontSize int +} + // move FileData and AsciiEntry here if you want, or leave in main.go -func file_handler(w http.ResponseWriter, r *http.Request) { +func FileHandler(w http.ResponseWriter, r *http.Request) { data := FileData{ ImageNames: []string{}, SpicyImageNames: []string{},