sum7/warehost
sum7
/
warehost
Archived
1
0
Fork 0
This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
warehost/modul/host/api.go

36 lines
837 B
Go
Raw Normal View History

2016-09-01 22:19:39 +02:00
package host
import (
"net/http"
"github.com/jinzhu/gorm"
2016-10-11 20:16:24 +02:00
"goji.io"
"goji.io/pat"
"golang.org/x/net/context"
2016-09-01 22:19:39 +02:00
2016-10-11 20:16:24 +02:00
libapi "dev.sum7.eu/sum7/warehost/lib/api"
liblog "dev.sum7.eu/sum7/warehost/lib/log"
2016-09-01 22:19:39 +02:00
)
//MODULNAME to get global name for the modul
const MODULNAME = "host"
2016-10-11 20:16:24 +02:00
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)
2016-09-01 22:19:39 +02:00
2016-10-11 20:16:24 +02:00
router.HandleFuncC(pat.Get(prefix+"/status"), libapi.SessionHandler(status))
2016-09-01 22:19:39 +02:00
}
// Status to get Login and Server status
2016-10-11 20:16:24 +02:00
func status(ctx context.Context, w http.ResponseWriter, r *http.Request) (returndata interface{}, returnerr *libapi.ErrorResult) {
2016-09-01 22:19:39 +02:00
returndata = true
2016-10-11 20:16:24 +02:00
logger := log.GetLog(r, "status")
2016-09-01 22:19:39 +02:00
logger.Info("status")
return
}