diff options
| author | xengineering <me@xengineering.eu> | 2026-05-23 21:15:10 +0200 |
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2026-05-23 21:20:13 +0200 |
| commit | 1307addddf61c7f811e8f4d360e2368ec7b4b2da (patch) | |
| tree | 248f908caada415967f4982b256139071f7b2606 /main.go | |
| parent | 15e9fcbb0cf96e087a5c7cd6fe581c368af9b32a (diff) | |
| download | finserv-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 'main.go')
| -rw-r--r-- | main.go | 14 |
1 files changed, 0 insertions, 14 deletions
@@ -2,7 +2,6 @@ package main import ( _ "embed" - "fmt" "log" "os" "os/signal" @@ -23,11 +22,6 @@ const ( var versionTxt string var router *mux.Router = mux.NewRouter() -func init() { - router.HandleFunc("/", hello) - router.HandleFunc("/version", version) -} - func main() { run() } @@ -49,14 +43,6 @@ func run() { await(syscall.SIGTERM, syscall.SIGINT) } -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) -} - func await(signals ...syscall.Signal) { listener := make(chan os.Signal, 1) for _, s := range signals { |
