add session handling

This commit is contained in:
Philipp 2021-08-29 17:09:48 +02:00
parent 5c7d92f4f3
commit a80dac4985
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 276B613AF9DBE9C3
10 changed files with 64 additions and 12 deletions

View file

@ -9,12 +9,19 @@ import (
)
func main() {
store, err := postgres.NewStore("postgres://postgres:secret@localhost/postgres?sslmode=disable")
dsn := "postgres://postgres:secret@localhost/postgres?sslmode=disable"
store, err := postgres.NewStore(dsn)
if err != nil {
log.Fatal(err)
}
sessions, err := web.NewSessionsManager(dsn)
if err != nil {
log.Fatal(err)
}
csrfKey := []byte("dmwij82jda92jf9a202na#d2.e3i!824")
h := web.NewHandler(store, csrfKey)
h := web.NewHandler(store, sessions, csrfKey)
http.ListenAndServe(":3000", h)
}