mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-10-05 09:53:21 +08:00
Initial commit
This commit is contained in:
23
handlers/new_instance.go
Normal file
23
handlers/new_instance.go
Normal file
@@ -0,0 +1,23 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user