diff options
author | jan <jan@ruken.pw> | 2015-12-19 14:43:00 (UTC) |
---|---|---|
committer | jan <jan@ruken.pw> | 2015-12-19 14:43:00 (UTC) |
commit | 6961005146be308546304e3e9f86a3d37750c297 (patch) | |
tree | 1d8e6809bec1bd050ad7f08e009b6cafce1179e7 | |
parent | bdf4e9cc5c5934281631af09bf9a7d58719d0cbb (diff) |
datenbankverbindung
-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() |