Changed file structure to align with the recommendations given by https://github.com/golang-standards/project-layout
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
package api
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package src
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package src
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"Advertisement_Panel/src"
|
"Advertisement_Panel/api"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
var templ *template.Template
|
var templates *template.Template
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
templ, _ = template.ParseGlob("templates/*.html")
|
templates, _ = template.ParseGlob("website/templates/*.html")
|
||||||
|
|
||||||
fmt.Print("Now running server!\n")
|
fmt.Print("Now running server!\n")
|
||||||
|
|
||||||
@@ -18,7 +18,7 @@ func main() {
|
|||||||
http.HandleFunc("/", index_handler)
|
http.HandleFunc("/", index_handler)
|
||||||
|
|
||||||
// Serves json for html to find file names
|
// Serves json for html to find file names
|
||||||
http.HandleFunc("/files", src.FileHandler)
|
http.HandleFunc("/files", api.FileHandler)
|
||||||
|
|
||||||
// Serves ascii page
|
// Serves ascii page
|
||||||
http.HandleFunc("/ascii", ascii_handler)
|
http.HandleFunc("/ascii", ascii_handler)
|
||||||
@@ -32,7 +32,7 @@ func main() {
|
|||||||
http.HandleFunc("/admin/", admin_handler)
|
http.HandleFunc("/admin/", admin_handler)
|
||||||
|
|
||||||
// Handles image upload
|
// Handles image upload
|
||||||
http.HandleFunc("/upload", src.UploadHandler)
|
http.HandleFunc("/upload", api.UploadHandler)
|
||||||
|
|
||||||
fmt.Print("Webserver running on http://localhost:8080\n")
|
fmt.Print("Webserver running on http://localhost:8080\n")
|
||||||
|
|
||||||
@@ -42,12 +42,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func index_handler(w http.ResponseWriter, r *http.Request) {
|
func index_handler(w http.ResponseWriter, r *http.Request) {
|
||||||
templ.ExecuteTemplate(w, "images.html", nil)
|
templates.ExecuteTemplate(w, "images.html", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ascii_handler(w http.ResponseWriter, r *http.Request) {
|
func ascii_handler(w http.ResponseWriter, r *http.Request) {
|
||||||
templ.ExecuteTemplate(w, "ascii.html", nil)
|
templates.ExecuteTemplate(w, "ascii.html", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func admin_handler(w http.ResponseWriter, r *http.Request) {
|
func admin_handler(w http.ResponseWriter, r *http.Request) {
|
||||||
templ.ExecuteTemplate(w, "admin.html", nil)
|
templates.ExecuteTemplate(w, "admin.html", nil)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
package src
|
|
||||||
@@ -21,6 +21,9 @@
|
|||||||
index = (index + 1) % images.length;
|
index = (index + 1) % images.length;
|
||||||
document.getElementById("images").src = images[index];
|
document.getElementById("images").src = images[index];
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, images.length*2*1000);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
Reference in New Issue
Block a user