pronounsfu/backend/routes/auth/routes.go

28 lines
627 B
Go
Raw Normal View History

2022-05-02 08:19:37 -07:00
package auth
import (
"net/http"
"github.com/go-chi/chi/v5"
"gitlab.com/1f320/pronouns/backend/server"
)
type Server struct {
*server.Server
}
func Mount(srv *server.Server, r chi.Router) {
s := &Server{srv}
_ = s
r.Route("/auth/discord", func(r chi.Router) {
r.Get("/authorize", nil) // generate csrf token, returns URL
r.Get("/callback", nil) // takes code + state, validates it, returns token OR discord signup ticket
r.Get("/signup", nil) // takes discord signup ticket to register account
r.Get("/test", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("hello world!"))
})
})
}