fix: replace index redirection
This commit is contained in:
parent
4fb7905f9d
commit
4f8ee6cf9c
2 changed files with 7 additions and 2 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
trafficlunar's API
|
trafficlunar's api
|
||||||
|
|
||||||
## features
|
## features
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -43,7 +44,11 @@ func NewRouter() {
|
||||||
}))
|
}))
|
||||||
|
|
||||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, "https://trafficlunar.net", http.StatusPermanentRedirect)
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
json.NewEncoder(w).Encode(map[string]string{
|
||||||
|
"name": "trafficlunar's api",
|
||||||
|
"url": "https://github.com/trafficlunar/api",
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
r.Get("/hit", handler.HandleGetHitCounter)
|
r.Get("/hit", handler.HandleGetHitCounter)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue