Working database connection
This commit is contained in:
@@ -2,6 +2,8 @@ package http
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
db "infra-dashboard/Database"
|
||||
opsys "infra-dashboard/OS"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -18,6 +20,19 @@ func HealthHandler(w http.ResponseWriter, _ *http.Request) {
|
||||
_, _ = io.WriteString(w, "OK")
|
||||
}
|
||||
|
||||
func GetOS(w http.ResponseWriter, r *http.Request) {
|
||||
t := time.Now()
|
||||
db_conn := db.GetDatabaseConnection()
|
||||
list, err := opsys.GetOS(db_conn)
|
||||
if err != nil {
|
||||
log.Println("Error getting OS list")
|
||||
}
|
||||
log.Println("list: ", list)
|
||||
|
||||
logRequest(t, r, 200)
|
||||
fmt.Fprint(w, "Hello, World!")
|
||||
}
|
||||
|
||||
func logRequest(t time.Time, r *http.Request, s int) {
|
||||
log.Printf("%s - - %s \"%s %s %s\" %d 0 \"-\" \"%s\" %d\n",
|
||||
r.Host,
|
||||
|
||||
Reference in New Issue
Block a user