Packages show API with tests. #116

This commit is contained in:
Andrey Smirnov
2015-02-07 18:50:52 +03:00
parent 930f76887b
commit a582493a6e
4 changed files with 64 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
package api
import (
"github.com/gin-gonic/gin"
)
// GET /api/packages/:key
func apiPackagesShow(c *gin.Context) {
p, err := context.CollectionFactory().PackageCollection().ByKey([]byte(c.Params.ByName("key")))
if err != nil {
c.Fail(404, err)
return
}
c.JSON(200, p)
}