diff options
author | Julio Capote <jcapote@gmail.com> | 2023-01-01 21:48:37 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2023-01-01 21:48:37 +0000 |
commit | b3f22c698739bdd57dab77af45a0b8a43da72ca4 (patch) | |
tree | 07d4bca01bc49d71d2ddceaa89f51487f0768047 /http | |
parent | 71495ac61587e3380f413b4d34669a68b5cd8068 (diff) | |
download | communique-b3f22c698739bdd57dab77af45a0b8a43da72ca4.tar.gz |
working ids and activity lookups
Diffstat (limited to 'http')
-rw-r--r-- | http/server.go | 31 |
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() } |