major refactoring of the api

This commit is contained in:
didier amyot committed 2015-03-28 20:53:28 -07:00
1 parent d4f7dc57fc
commit f0628e4682
38 files changed
+821 -367

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
package api
import (
"encoding/json"
"net/http"
)
func GetDoorman(w http.ResponseWriter, r *http.Request) {
id := getDoormanIdFromRequest(w, r)
if id == "" {
Write404Error(w)
return
}
doorman, err := conn.GetDoorman(id)
if err != nil {
Write500Error(w, err)
} else if doorman == nil {
Write404Error(w)
} else {
encoder := json.NewEncoder(w)
encoder.Encode(doorman)
}
}