GET /codeshare/code/:hash
(c *gin.Context)
| 53 | |
| 54 | // GET /codeshare/code/:hash |
| 55 | func (h *CodeShareHandler) Get(c *gin.Context) { |
| 56 | hash := c.Param("hash") |
| 57 | |
| 58 | code, ok := h.cs.Get(hash) |
| 59 | if !ok { |
| 60 | c.JSON(http.StatusNotFound, gin.H{ |
| 61 | "error": "Code not found or expired", |
| 62 | }) |
| 63 | return |
| 64 | } |
| 65 | |
| 66 | c.JSON(http.StatusOK, code) |
| 67 | } |