diff options
author | xengineering <mail2xengineering@protonmail.com> | 2021-06-11 11:40:46 +0200 |
---|---|---|
committer | xengineering <mail2xengineering@protonmail.com> | 2021-06-11 11:40:46 +0200 |
commit | 6df5b35600e6aae6e676e2ba29eeaaf88bf9ff9b (patch) | |
tree | 1c415dca51dcb61a06551188232982b29c38c77d /src | |
parent | d4e1f48ff12db48e9a9bdbd3253c1041328ca66d (diff) | |
download | birdscan-6df5b35600e6aae6e676e2ba29eeaaf88bf9ff9b.tar birdscan-6df5b35600e6aae6e676e2ba29eeaaf88bf9ff9b.tar.zst birdscan-6df5b35600e6aae6e676e2ba29eeaaf88bf9ff9b.zip |
Implement AJAX Call
Diffstat (limited to 'src')
-rw-r--r-- | src/web.go | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -26,6 +26,8 @@ func runServer(cfg *webConfig) { router.Get("/", indexHandler) router.Get("/css/birdscan.css", cssHandler) + router.Get("/js/birdscan.js", jsHandler) + router.Post("/api/single_picture", singlePictureHandler) log.Println("Binding to 'http://" + cfg.BindAddress + ":" + cfg.BindPort + "'") log.Fatal(http.ListenAndServe(cfg.BindAddress + ":" + cfg.BindPort, router)) @@ -39,3 +41,12 @@ func cssHandler(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, fmt.Sprintf("%s/css/birdscan.css", APP_DATA)) } +func jsHandler(w http.ResponseWriter, r *http.Request) { + http.ServeFile(w, r, fmt.Sprintf("%s/js/birdscan.js", APP_DATA)) +} + +func singlePictureHandler(w http.ResponseWriter, r *http.Request) { + log.Println("Received request for a single picture") + fmt.Fprintf(w, http.StatusText(http.StatusOK)) +} + |