Session
This commit is contained in:
parent
79288b0483
commit
b8a673fb0a
7 changed files with 148 additions and 29 deletions
|
|
@ -3,10 +3,26 @@ package main
|
|||
import (
|
||||
// Standard
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Request struct {
|
||||
ID string
|
||||
}
|
||||
|
||||
func (req *Request)
|
||||
func responseError(w http.ResponseWriter, err error) {
|
||||
res := map[string]interface{}{
|
||||
"ok": false,
|
||||
"error": err.Error(),
|
||||
}
|
||||
resJSON, _ := json.Marshal(res)
|
||||
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
w.Write(resJSON)
|
||||
}
|
||||
|
||||
func responseData(w http.ResponseWriter, data interface{}) {
|
||||
resJSON, _ := json.Marshal(data)
|
||||
w.Header().Add("Content-Type", "application/json")
|
||||
w.Write(resJSON)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue