Files
play-with-docker/handlers/home.go
Jonathan Leibiusky @xetorthio a703f22997 Fixes #145
2017-05-19 10:16:00 -03:00

26 lines
521 B
Go

package handlers
import (
"net/http"
"github.com/gorilla/mux"
"github.com/play-with-docker/play-with-docker/services"
)
func Home(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
sessionId := vars["sessionId"]
s := services.GetSession(sessionId)
if s == nil {
// Session doesn't exist (can happen if closing the sessions an reloading the page, or similar).
w.WriteHeader(http.StatusNotFound)
return
}
if s.Stack != "" {
go s.DeployStack()
}
http.ServeFile(w, r, "./www/index.html")
}