Get 获取项目详情
(w http.ResponseWriter, r *http.Request)
| 239 | |
| 240 | // Get 获取项目详情 |
| 241 | func (h *ProjectHandler) Get(w http.ResponseWriter, r *http.Request) { |
| 242 | if r.Method != http.MethodGet { |
| 243 | http.Error(w, "Method not allowed", http.StatusMethodNotAllowed) |
| 244 | return |
| 245 | } |
| 246 | id := r.URL.Query().Get("id") |
| 247 | p := h.store.Get(id) |
| 248 | if p == nil { |
| 249 | writeJSON(w, http.StatusNotFound, map[string]string{"error": "project not found"}) |
| 250 | return |
| 251 | } |
| 252 | writeJSON(w, http.StatusOK, p) |
| 253 | } |
| 254 | |
| 255 | // Delete 删除项目 |
| 256 | func (h *ProjectHandler) Delete(w http.ResponseWriter, r *http.Request) { |