scouting: Allow the requests handler access to the database

This patch makes it so the requests handlers actually have access to
the database. In the unit tests we use a mock database, but in the
`webserver` binary we use the real one.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Iaf5b2c039a275dd6ddfbff173aa6ad59cf3988b5
diff --git a/scouting/webserver/main.go b/scouting/webserver/main.go
index 2baf36d..668104b 100644
--- a/scouting/webserver/main.go
+++ b/scouting/webserver/main.go
@@ -3,10 +3,12 @@
 import (
 	"flag"
 	"fmt"
+	"log"
 	"os"
 	"os/signal"
 	"syscall"
 
+	"github.com/frc971/971-Robot-Code/scouting/db"
 	"github.com/frc971/971-Robot-Code/scouting/webserver/requests"
 	"github.com/frc971/971-Robot-Code/scouting/webserver/server"
 	"github.com/frc971/971-Robot-Code/scouting/webserver/static"
@@ -17,9 +19,14 @@
 	dirPtr := flag.String("directory", ".", "The directory to serve at /.")
 	flag.Parse()
 
+	database, err := db.NewDatabase()
+	if err != nil {
+		log.Fatal("Failed to connect to database: ", err)
+	}
+
 	scoutingServer := server.NewScoutingServer()
 	static.ServePages(scoutingServer, *dirPtr)
-	requests.HandleRequests(scoutingServer)
+	requests.HandleRequests(database, scoutingServer)
 	scoutingServer.Start(*portPtr)
 	fmt.Println("Serving", *dirPtr, "on port", *portPtr)