forked from
tangled.org/core
fork
Configure Feed
Select the types of activity you want to include in your feed.
this repo has no description
fork
Configure Feed
Select the types of activity you want to include in your feed.
1package knotserver
2
3import (
4 "encoding/json"
5 "net/http"
6)
7
8func writeJSON(w http.ResponseWriter, data interface{}) {
9 w.Header().Set("Content-Type", "application/json")
10 w.WriteHeader(http.StatusOK)
11 json.NewEncoder(w).Encode(data)
12}
13
14func writeError(w http.ResponseWriter, msg string, status int) {
15 w.Header().Set("Content-Type", "application/json")
16 w.WriteHeader(status)
17 json.NewEncoder(w).Encode(map[string]string{"error": msg})
18}
19
20func notFound(w http.ResponseWriter) {
21 writeError(w, "not found", http.StatusNotFound)
22}
23
24func writeMsg(w http.ResponseWriter, msg string) {
25 writeJSON(w, map[string]string{"msg": msg})
26}