aboutsummaryrefslogtreecommitdiff
path: root/http/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'http/server.go')
-rw-r--r--http/server.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/http/server.go b/http/server.go
index 98b4083..7d18085 100644
--- a/http/server.go
+++ b/http/server.go
@@ -8,6 +8,7 @@ import (
"github.com/gin-gonic/gin"
)
+// TODO rename to Router and router.go
type Server struct {
registry *registry.Registry
}
@@ -76,22 +77,20 @@ func (s *Server) Start(zapWriter io.Writer) {
}
})
- // // outbox single
- // router.GET("/actors/:actor/outbox/:id", func(c *gin.Context) {
- // actorParam := c.Param("actor")
- // var resource map[string]interface{}
- // if c.Query("page") == "true" {
- // resource, _ = s.registry.OutboxPage(actorParam)
- // } else {
- // resource, _ = s.registry.Outbox(actorParam)
- // }
- // if resource != nil {
- // c.Writer.Header().Set("Content-Type", "application/activity+json")
- // c.JSON(http.StatusOK, resource)
- // } else {
- // c.JSON(http.StatusNotFound, nil)
- // }
- // })
+ // Single activity
+ router.GET("/actors/:actor/outbox/:id/activity", func(c *gin.Context) {
+ actorParam := c.Param("actor")
+ idParam := c.Param("id")
+ var resource map[string]interface{}
+ resource, _ = s.registry.Activity(actorParam, idParam)
+
+ if resource != nil {
+ c.Writer.Header().Set("Content-Type", "application/activity+json")
+ c.JSON(http.StatusOK, resource)
+ } else {
+ c.JSON(http.StatusNotFound, nil)
+ }
+ })
router.Run()
}