summaryrefslogtreecommitdiff
path: root/internal/server/handler/handler.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-08-12 10:41:11 +0300
committerPaul Buetow <paul@buetow.org>2024-08-12 10:41:11 +0300
commitb79de37224b40374cd0bc17881b3677138c44935 (patch)
tree94db4343ed6ae9dfc35c820f81a0b862d6e8e652 /internal/server/handler/handler.go
parent29705a8e5aad0c5edd4ed720e5c4b5d58a91c6e6 (diff)
initially can merge from remote partner but file to disk sync doesn't work yet maybe next time when i work on this this will be sorted.
Diffstat (limited to 'internal/server/handler/handler.go')
-rw-r--r--internal/server/handler/handler.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/server/handler/handler.go b/internal/server/handler/handler.go
index fa1022e..25a4d12 100644
--- a/internal/server/handler/handler.go
+++ b/internal/server/handler/handler.go
@@ -20,7 +20,8 @@ type Handler struct {
func New(conf server.ServerConfig) Handler {
return Handler{
conf: conf,
- getIdRe: regexp.MustCompile(`^/[0-9]{4}/[a-z0-9]{64}\.json$`),
+ getIdRe: regexp.MustCompile(`^[a-z0-9]{64}$`),
+ // getIdRe: regexp.MustCompile(`^/[0-9]{4}/[a-z0-9]{64}\.json$`),
}
}
@@ -66,7 +67,11 @@ func (h Handler) Get(w http.ResponseWriter, r *http.Request) error {
return fmt.Errorf("no entry with id %s found", id)
}
- fmt.Fprint(w, ent.String())
+ jsonBytes, err := ent.Serialize()
+ if err != nil {
+ return err
+ }
+ fmt.Fprint(w, string(jsonBytes))
return nil
}