36 lines
837 B
Go
36 lines
837 B
Go
package host
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/jinzhu/gorm"
|
|
"goji.io"
|
|
"goji.io/pat"
|
|
"golang.org/x/net/context"
|
|
|
|
libapi "dev.sum7.eu/sum7/warehost/lib/api"
|
|
liblog "dev.sum7.eu/sum7/warehost/lib/log"
|
|
)
|
|
|
|
//MODULNAME to get global name for the modul
|
|
const MODULNAME = "host"
|
|
|
|
var dbconnection *gorm.DB
|
|
var log *liblog.ModulLog
|
|
|
|
// BindAPI sets the routes to the api functions
|
|
func BindAPI(db *gorm.DB, router *goji.Mux, prefix string) {
|
|
dbconnection = db
|
|
log = liblog.NewModulLog(MODULNAME)
|
|
|
|
router.HandleFuncC(pat.Get(prefix+"/status"), libapi.SessionHandler(status))
|
|
}
|
|
|
|
// Status to get Login and Server status
|
|
func status(ctx context.Context, w http.ResponseWriter, r *http.Request) (returndata interface{}, returnerr *libapi.ErrorResult) {
|
|
returndata = true
|
|
logger := log.GetLog(r, "status")
|
|
logger.Info("status")
|
|
return
|
|
}
|