mood/inspo boards

more setup / learning

besaid.zone 71316100 d16e527b

verified
Changed files
+44 -4
cmd
internal
app
services
+2 -1
.gitignore
··· 1 - build 1 + build 2 + .env
+1 -1
cmd/main.go
··· 44 44 Name: "port", 45 45 Usage: "Port to bind the HTTP server to", 46 46 Value: ":8080", 47 - Sources: cli.EnvVars("SERVER_PORT"), 47 + Sources: cli.EnvVars("PORT"), 48 48 }, 49 49 }, 50 50 },
+10 -2
internal/app/app.go
··· 2 2 3 3 import ( 4 4 "database/sql" 5 - "fmt" 6 5 "log/slog" 7 6 "net/http" 8 7 "time" ··· 34 33 Handler: router, 35 34 } 36 35 36 + // actorStore := actor.NewStore(s.db) 37 + // actorHandler := actor.NewHandler(actorStore) 38 + // actorHandler.RegisterRoutes() 39 + 37 40 router.HandleFunc("/healthcheck", func(w http.ResponseWriter, r *http.Request) { 38 41 w.WriteHeader(http.StatusOK); 39 - fmt.Fprintf(w, "reporting for duty") 42 + w.Write([]byte("reporting for duty")) 43 + }) 44 + 45 + router.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { 46 + w.WriteHeader(http.StatusOK) 47 + w.Write([]byte("hello world")) 40 48 }) 41 49 42 50 s.logger.Info("app server started")
+17
internal/services/actor/routes.go
··· 1 + package actor 2 + 3 + import "github.com/gorilla/mux" 4 + 5 + type ActorStore interface {} 6 + 7 + type Handler struct { 8 + store ActorStore 9 + } 10 + 11 + func NewHandler(store ActorStore) *Handler { 12 + return &Handler{store} 13 + } 14 + 15 + func (h *Handler) RegisterRoutes(router *mux.Router) { 16 + router.HandleFunc("/login", nil).Methods("POST") 17 + }
+11
internal/services/actor/store.go
··· 1 + package actor 2 + 3 + import "database/sql" 4 + 5 + type Store struct { 6 + db *sql.DB 7 + } 8 + 9 + func NewStore(db *sql.DB) *Store { 10 + return &Store{db} 11 + }
+3
justfile
··· 1 + default: 2 + @just --list 3 + 1 4 dev: 2 5 go run cmd/*.go start 3 6