mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 15:12:26 +00:00
Refactor handler methods to use instance methods for logging and error handling; add utility functions for UUID generation and JSON error responses.
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/akyaiy/GoSally-mvp/internal/config"
|
||||
"github.com/akyaiy/GoSally-mvp/internal/logs"
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"regexp"
|
||||
|
||||
"github.com/akyaiy/GoSally-mvp/internal/config"
|
||||
"github.com/akyaiy/GoSally-mvp/internal/logs"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
@@ -42,13 +41,3 @@ func main() {
|
||||
http.ListenAndServe(cfg.Address, r)
|
||||
|
||||
}
|
||||
|
||||
func newUUID() string {
|
||||
bytes := make([]byte, 16)
|
||||
_, err := rand.Read(bytes)
|
||||
if err != nil {
|
||||
log.Error("Failed to generate UUID", slog.String("error", err.Error()))
|
||||
return ""
|
||||
}
|
||||
return hex.EncodeToString(bytes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user