aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2016-12-18 08:56:35 -0800
committerChristine Dodrill <me@christine.website>2016-12-18 08:56:35 -0800
commit5ec7046253e037c0c40783bbc9e9415d26212235 (patch)
tree297603abd1e69f01ecaea9cb0253ad6e91b93f9f
parentdba3ae46f8cbf9eca60e324447e7715744c2130b (diff)
downloadxesite-5ec7046253e037c0c40783bbc9e9415d26212235.tar.xz
xesite-5ec7046253e037c0c40783bbc9e9415d26212235.zip
backend: don't send post bodies to post listing clients
-rw-r--r--backend/christine.website/main.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/backend/christine.website/main.go b/backend/christine.website/main.go
index a6a29f4..e271802 100644
--- a/backend/christine.website/main.go
+++ b/backend/christine.website/main.go
@@ -134,7 +134,21 @@ func main() {
}
func writeBlogPosts(w http.ResponseWriter, r *http.Request) {
- json.NewEncoder(w).Encode(posts)
+ p := []interface{}{}
+ for _, post := range posts {
+ p = append(p, struct {
+ Title string `json:"title"`
+ Link string `json:"link"`
+ Summary string `json:"summary,omitifempty"`
+ Date string `json:"date"`
+ }{
+ Title: post.Title,
+ Link: post.Link,
+ Summary: post.Summary,
+ Date: post.Date,
+ })
+ }
+ json.NewEncoder(w).Encode(p)
}
func writeIndexHTML(w http.ResponseWriter, r *http.Request) {