-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.go
38 lines (28 loc) · 1.07 KB
/
routes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package main
import (
"github.com/fouched/go-bookings/internal/config"
"github.com/fouched/go-bookings/internal/handlers"
"github.com/go-chi/chi/v5"
"github.com/go-chi/chi/v5/middleware"
"net/http"
)
func routes(app *config.AppConfig) http.Handler {
mux := chi.NewRouter()
mux.Use(middleware.Recoverer)
mux.Use(NoSurf)
mux.Use(SessionLoad)
mux.Get("/", handlers.Repo.Home)
mux.Get("/about", handlers.Repo.About)
mux.Get("/generals-quarters", handlers.Repo.Generals)
mux.Get("/majors-suite", handlers.Repo.Majors)
mux.Get("/search-availability", handlers.Repo.Availability)
mux.Post("/search-availability", handlers.Repo.PostAvailability)
mux.Post("/search-availability-json", handlers.Repo.AvailabilityJSON)
mux.Get("/contact", handlers.Repo.Contact)
mux.Get("/make-reservation", handlers.Repo.Reservation)
mux.Post("/make-reservation", handlers.Repo.PostReservation)
mux.Get("/reservation-summary", handlers.Repo.ReservationSummary)
fileServer := http.FileServer(http.Dir("./static/"))
mux.Handle("/static/*", http.StripPrefix("/static", fileServer))
return mux
}