feat: use postgres to fetch and store user info
This commit is contained in:
parent
79e8ece948
commit
6cbf0afb33
9 changed files with 175 additions and 42 deletions
|
|
@ -1,6 +1,9 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
auth "nyanimedb/auth"
|
||||
|
|
@ -9,14 +12,22 @@ import (
|
|||
|
||||
"github.com/gin-contrib/cors"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
)
|
||||
|
||||
var AppConfig Config
|
||||
|
||||
func main() {
|
||||
// TODO: env args
|
||||
r := gin.Default()
|
||||
|
||||
var queries *sqlc.Queries = nil
|
||||
pool, err := pgxpool.New(context.Background(), os.Getenv("DATABASE_URL"))
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Unable to connect to database: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var queries *sqlc.Queries = sqlc.New(pool)
|
||||
|
||||
server := handlers.NewServer(queries)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue