package main import ( "encoding/json" "llostre/backend/fetchers" "net/http" ) func postsHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") w.Header().Set("Content-Type", "application/json") // wip did := "did:plc:hyyqbqqhpxt2bnn7s2e2iuxd" pdsURL := "https://bsky.vylion.com" posts, err := fetchers.FetchBlueskyPosts(did, pdsURL) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } jsonData, err := json.Marshal(posts) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } w.Write(jsonData) } func main() { http.HandleFunc("/api/posts", postsHandler) http.ListenAndServe(":8080", nil) }