aboutsummaryrefslogtreecommitdiff
path: root/http/server.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--http/server.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/http/server.go b/http/server.go
index c720a6d..e0050b2 100644
--- a/http/server.go
+++ b/http/server.go
@@ -22,6 +22,7 @@ func (s *Server) Start(zapWriter io.Writer) {
gin.DisableConsoleColor()
gin.DefaultWriter = zapWriter // send gin logs to zap
+ // Webfinger
router.GET("/.well-known/webfinger", func(c *gin.Context) {
resourceParam := c.Query("resource")
resource := s.registry.LookupResource(resourceParam)
@@ -33,6 +34,7 @@ func (s *Server) Start(zapWriter io.Writer) {
})
+ // "User" endpoint
router.GET("/actors/:actor", func(c *gin.Context) {
actorParam := c.Param("actor")
resource := s.registry.LookupByName(actorParam)
@@ -44,5 +46,28 @@ func (s *Server) Start(zapWriter io.Writer) {
})
+ // Inbox
+ router.POST("/actors/:actor/inbox", func(c *gin.Context) {
+ actorParam := c.Param("actor")
+ resource := s.registry.LookupByName(actorParam)
+ if resource != nil {
+ c.JSON(http.StatusOK, resource)
+ } else {
+ c.JSON(http.StatusNotFound, nil)
+ }
+
+ })
+ // Outbox
+ router.GET("/actors/:actor/outbox", func(c *gin.Context) {
+ actorParam := c.Param("actor")
+ resource := s.registry.LookupByName(actorParam)
+ if resource != nil {
+ c.JSON(http.StatusOK, resource)
+ } else {
+ c.JSON(http.StatusNotFound, nil)
+ }
+
+ })
+
router.Run()
}