Initial interface to connect to server using gui

This commit is contained in:
Dan Sosedoff
2014-11-01 15:44:24 -05:00
parent 7ac9bee098
commit 9a431f6e41
5 changed files with 180 additions and 49 deletions

10
api.go
View File

@@ -57,7 +57,10 @@ func API_Connect(c *gin.Context) {
info, err := client.Info()
if err == nil {
dbClient.db.Close()
if dbClient != nil {
dbClient.db.Close()
}
dbClient = client
}
@@ -135,6 +138,11 @@ func API_History(c *gin.Context) {
}
func API_Info(c *gin.Context) {
if dbClient == nil {
c.JSON(400, Error{"Not connected"})
return
}
res, err := dbClient.Info()
if err != nil {