1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 01:57:32 +08:00
docker-labs/handlers/get_session.go
Marcos Nils a4b0a98df3 Scaling (#109)
Make PWD scalable
2017-03-13 18:07:20 -03:00

24 lines
406 B
Go

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