summaryrefslogtreecommitdiff
path: root/handlers.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2026-05-23 21:15:10 +0200
committerxengineering <me@xengineering.eu>2026-05-23 21:20:13 +0200
commit1307addddf61c7f811e8f4d360e2368ec7b4b2da (patch)
tree248f908caada415967f4982b256139071f7b2606 /handlers.go
parent15e9fcbb0cf96e087a5c7cd6fe581c368af9b32a (diff)
downloadfinserv-1307addddf61c7f811e8f4d360e2368ec7b4b2da.tar
finserv-1307addddf61c7f811e8f4d360e2368ec7b4b2da.tar.zst
finserv-1307addddf61c7f811e8f4d360e2368ec7b4b2da.zip
Add handlers.go
This keeps the HTTP handlers in a separate file which registers the routes in an init() function. The main execution flow is still maintained in a now minimal main.go.
Diffstat (limited to 'handlers.go')
-rw-r--r--handlers.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/handlers.go b/handlers.go
new file mode 100644
index 0000000..0f6593f
--- /dev/null
+++ b/handlers.go
@@ -0,0 +1,19 @@
+package main
+
+import (
+ "fmt"
+ "net/http"
+)
+
+func init() {
+ router.HandleFunc("/", hello)
+ router.HandleFunc("/version", version)
+}
+
+func hello(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, "Hello world!")
+}
+
+func version(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprint(w, versionTxt)
+}