diff --git a/main.go b/main.go index 4784c2b..d2282d5 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,13 @@ package main import ( + "database/sql" "fmt" "html/template" "log" "net/http" - //"strings" + + _ "github.com/mattn/go-sqlite3" ) func opisStołówkaZPM(w http.ResponseWriter, r *http.Request) { @@ -20,7 +22,7 @@ func panel(w http.ResponseWriter, r *http.Request) { } func login(w http.ResponseWriter, r *http.Request) { -Here: + //Here: fmt.Println("method:", r.Method) if r.Method == "GET" { t, _ := template.ParseFiles("login.gtpl") @@ -48,6 +50,10 @@ Here: } } +func init() { + sql.Register("sqlite3", &SQLiteDriver{}) +} + func main() { http.HandleFunc("/", opisStołówkaZPM) http.HandleFunc("/login", login) @@ -56,5 +62,7 @@ func main() { if err != nil { log.Fatal("ListenAndServe: ", err) } + db, err := sql.Open("sqlite3", "./stolowka.db") + checkErr(err) }