forked from muety/wakapi
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First time every in GO. Surprisingly does work.
- Loading branch information
1 parent
6ad4b11
commit 8cbb530
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package api | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/go-chi/chi/v5" | ||
) | ||
|
||
type RedirectApiHandler struct{} | ||
|
||
func NewRedirectApiHandler() *RedirectApiHandler { | ||
return &RedirectApiHandler{} | ||
} | ||
|
||
func (h *RedirectApiHandler) RegisterRoutes(router chi.Router) { | ||
router.Get("/", h.Redirect) | ||
} | ||
|
||
// Redirect redirects the user to / | ||
func (h *RedirectApiHandler) Redirect(w http.ResponseWriter, r *http.Request) { | ||
http.Redirect(w, r, "/", http.StatusFound) | ||
} |