1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 01:57:32 +08:00
docker-labs/handlers/new_instance.go
Jonathan Leibiusky (@xetorthio) dde49d8700 Initial commit
2016-10-08 03:12:48 +02:00

24 lines
436 B
Go

package handlers
import (
"encoding/json"
"log"
"net/http"
"github.com/go-zoo/bone"
"github.com/xetorthio/play-with-docker/services"
)
func NewInstance(rw http.ResponseWriter, req *http.Request) {
sessionId := bone.GetValue(req, "sessionId")
s := services.GetSession(sessionId)
i, err := services.NewInstance(s)
if err != nil {
log.Println(err)
//TODO: Set a status error
} else {
json.NewEncoder(rw).Encode(i)
}
}