diff options
-rw-r--r-- | main.go | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1,16 +1,26 @@ | |||
1 | package main | 1 | package main |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "database/sql" | ||
4 | login "fagott.pw/charakterin" | 5 | login "fagott.pw/charakterin" |
5 | "fagott.pw/grilist/frontend" | 6 | "fagott.pw/grilist/frontend" |
6 | "github.com/julienschmidt/httprouter" | 7 | "github.com/julienschmidt/httprouter" |
7 | "log" | 8 | "log" |
8 | "net/http" | 9 | "net/http" |
10 | |||
11 | _ "github.com/lib/pq" | ||
9 | ) | 12 | ) |
10 | 13 | ||
11 | func main() { | 14 | func main() { |
15 | // Datenbankverbindung aufbauen | ||
16 | db, err := sql.Open("postgres", "host=grilist.moe user=grilist dbname=grilist password=grilist sslmode=disable") | ||
17 | if err != nil { | ||
18 | log.Fatal(err) | ||
19 | } | ||
20 | log.Println("database connection established") | ||
21 | |||
12 | frontend := frontend.New("views") | 22 | frontend := frontend.New("views") |
13 | charakterin := login.New() | 23 | charakterin := login.New(db) |
14 | charakterin.UseRenderer(frontend) | 24 | charakterin.UseRenderer(frontend) |
15 | 25 | ||
16 | router := httprouter.New() | 26 | router := httprouter.New() |