Files
play-with-docker/handlers/get_session.go
Jonathan Leibiusky @xetorthio 3d96760a98 WIP
2017-05-23 19:29:36 -03:00

23 lines
354 B
Go

package handlers
import (
"encoding/json"
"net/http"
"github.com/gorilla/mux"
)
func GetSession(rw http.ResponseWriter, req *http.Request) {
vars := mux.Vars(req)
sessionId := vars["sessionId"]
session := core.SessionGet(sessionId)
if session == nil {
rw.WriteHeader(http.StatusNotFound)
return
}
json.NewEncoder(rw).Encode(session)
}