mirror of
https://github.com/trafficlunar/api.git
synced 2026-06-27 22:24:08 +00:00
feat: data store
This commit is contained in:
parent
4f8ee6cf9c
commit
19bdd27de1
8 changed files with 123 additions and 53 deletions
|
|
@ -2,12 +2,16 @@ package handler
|
|||
|
||||
import (
|
||||
"api/internal/service"
|
||||
"api/internal/storage"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func HandleGetHitCounter(w http.ResponseWriter, r *http.Request) {
|
||||
data := service.GetHitCounter()
|
||||
data := storage.GlobalDataStore.Get("hits")
|
||||
if data == nil {
|
||||
data = 0
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue