From e66691083a2455c29b50a2970c0aba1d6afca753 Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 23 Oct 2024 20:34:57 +0200 Subject: Switch to http.Handler The used `func(http.ResponseWriter, *http.Request)` return values made the HTTP handler factory functions quite unreadable. Thus it is switched to the http.Handler type. --- view/index.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'view/index.go') diff --git a/view/index.go b/view/index.go index 7d12783..46389d5 100644 --- a/view/index.go +++ b/view/index.go @@ -4,6 +4,10 @@ import ( "net/http" ) -func IndexRead(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, "/recipes", http.StatusSeeOther) +func IndexRead() http.Handler { + return http.HandlerFunc( + func(w http.ResponseWriter, r *http.Request) { + http.Redirect(w, r, "/recipes", http.StatusSeeOther) + }, + ) } -- cgit v1.2.3-70-g09d2