a8862721cd
Static directory for public folders and business logic for the app within internal, split into domain specific folders to keep clear seperation of concerns.
29 lines
570 B
Go
29 lines
570 B
Go
package web
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/go-chi/chi/v5/middleware"
|
|
)
|
|
|
|
func (s *Server) setupRoutes() *chi.Mux {
|
|
router := chi.NewRouter()
|
|
|
|
router.Use(middleware.Logger)
|
|
router.Use(middleware.Recoverer)
|
|
|
|
// Setup basic file server nothing fancy
|
|
router.Handle("/static/*", http.StripPrefix("/static", http.FileServer(http.Dir("static"))))
|
|
|
|
// Public routes
|
|
router.Group(func(r chi.Router) {
|
|
r.Get("/", s.handleHome())
|
|
})
|
|
|
|
//s.router.Get("/", s.handleIndex())
|
|
//s.router.Post("/users", s.handleCreateUser())
|
|
|
|
return router
|
|
}
|