mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-07-13 17:42:53 +08:00
24 lines
415 B
Go
24 lines
415 B
Go
package handlers
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
"github.com/play-with-docker/play-with-docker/services"
|
|
)
|
|
|
|
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)
|
|
}
|