Files

29 lines
893 B
Go

package router
import (
"net/http"
tinder "tinder-api-wrapper"
"tinder-api-wrapper/cmd/server/handlers"
)
// Setup creates and configures the HTTP router
func Setup(client *tinder.Client) http.Handler {
mux := http.NewServeMux()
// Core endpoints
mux.HandleFunc("/like/", handlers.HandleLike(client))
mux.HandleFunc("/pass/", handlers.HandlePass(client))
mux.HandleFunc("/v2/recs/core", handlers.HandleGetRecs(client))
// Auth endpoints
mux.HandleFunc("/v2/auth/sms/send", handlers.HandleSendPhoneAuth(client))
mux.HandleFunc("/v2/auth/sms/validate", handlers.HandleValidateOTP(client))
mux.HandleFunc("/v2/auth/facebook", handlers.HandleFacebookAuth(client))
mux.HandleFunc("/v2/auth/login/refresh", handlers.HandleRefreshAuth(client))
mux.HandleFunc("/v2/profile", handlers.HandleGetProfile(client))
// Wrap with logging middleware
return handlers.LogMiddleware(mux)
}