aboutsummaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-12-18 22:18:42 +0000
committerJulio Capote <jcapote@gmail.com>2022-12-18 22:18:42 +0000
commitf0efb48bbd45ffd149cd9eb0603f7916ab9d8b67 (patch)
tree70ec7746b861d2f8791a4919a1247610605be211 /http
parent20faf99a2076905159a6d623a3f59f5eca1f808b (diff)
downloadcommunique-f0efb48bbd45ffd149cd9eb0603f7916ab9d8b67.tar.gz
start of profiles
Diffstat (limited to 'http')
-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()
}