feat:lab4-catchup
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
package api
|
||||
|
||||
import "net/http"
|
||||
|
||||
func NewRouter(h *Handler, instanceID string) http.Handler {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("GET /health/live", h.Live)
|
||||
mux.HandleFunc("GET /health/ready", h.Ready)
|
||||
mux.HandleFunc("POST /api/v1/users", h.CreateUser)
|
||||
mux.HandleFunc("GET /api/v1/users/me", h.CurrentUser)
|
||||
mux.HandleFunc("POST /api/v1/auth/sessions", h.CreateSession)
|
||||
mux.HandleFunc("DELETE /api/v1/auth/sessions/current", h.RevokeSession)
|
||||
mux.HandleFunc("POST /api/v1/chats", h.CreateChat)
|
||||
mux.HandleFunc("GET /api/v1/chats", h.ListChats)
|
||||
mux.HandleFunc("GET /api/v1/chats/{chat_id}", h.GetChat)
|
||||
mux.HandleFunc("POST /api/v1/chats/{chat_id}/messages", h.CreateMessage)
|
||||
mux.HandleFunc("GET /api/v1/chats/{chat_id}/messages", h.ListMessages)
|
||||
mux.HandleFunc("POST /api/v1/chats/{chat_id}/attachments", h.UploadAttachment)
|
||||
mux.HandleFunc("GET /api/v1/attachments/{attachment_id}", h.GetAttachment)
|
||||
mux.HandleFunc("GET /api/v1/attachments/{attachment_id}/content", h.DownloadAttachment)
|
||||
|
||||
// Порядок: instanceID снаружи, requestID внутри.
|
||||
return withInstanceID(instanceID)(withRequestID(mux))
|
||||
}
|
||||
Reference in New Issue
Block a user