init
This commit is contained in:
27
ca-server/internal/routes/api_routes.go
Normal file
27
ca-server/internal/routes/api_routes.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"ca-mini/internal/handlers"
|
||||
"ca-mini/internal/middleware"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
// SetupAPIRoutes 初始化API路由
|
||||
func SetupAPIRoutes(r *mux.Router) {
|
||||
|
||||
r.HandleFunc("/CaRoot.crl", handlers.DownloadCRL).Methods("GET")
|
||||
r.HandleFunc("/user/login", handlers.Login).Methods("POST")
|
||||
r.HandleFunc("/user/logout", handlers.Logout).Methods("POST")
|
||||
r.HandleFunc("/user/info", handlers.GetUserInfo).Methods("GET")
|
||||
|
||||
api := r.PathPrefix("/api/v1").Subrouter()
|
||||
|
||||
// api.Use(middleware.JWTMiddleware)
|
||||
api.Use(middleware.LoggerMiddleware)
|
||||
|
||||
api.HandleFunc("/certificates", handlers.IssueCertificate).Methods("POST")
|
||||
api.HandleFunc("/blacklist", handlers.CheckBlacklist).Methods("GET")
|
||||
api.HandleFunc("/certificates/{id}", handlers.GetCertificate).Methods("GET")
|
||||
api.HandleFunc("/certificates/{id}", handlers.RevokeCertificate).Methods("DELETE")
|
||||
}
|
||||
Reference in New Issue
Block a user