auth

Paddy 2015-05-11 Parent:8267e1c8bcd1

165:04c8edf89e3b Go to Latest

auth/postgres.go

Support CORS. Add support for the OPTIONS method on certain endpoints. Automatically add headers (and respond to) OPTIONS requests. Note that these headers are full of deceit and mendacity, and we should switch to trout soon so we can actually be honest about what methods we support.

History
1 package auth
3 import (
4 "database/sql"
5 )
7 func NewPostgres(conn string) (postgres, error) {
8 db, err := sql.Open("postgres", conn)
9 if err != nil {
10 return postgres{}, err
11 }
12 return postgres{db: db}, nil
13 }
15 type postgres struct {
16 db *sql.DB
17 }