initial commit

This commit is contained in:
Jordan Knott
2020-04-09 21:40:22 -05:00
commit 9611105364
141 changed files with 29236 additions and 0 deletions

28
api/cmd/citadel/main.go Normal file
View File

@ -0,0 +1,28 @@
package main
import (
_ "github.com/lib/pq"
"fmt"
"net/http"
"github.com/jmoiron/sqlx"
"github.com/jordanknott/project-citadel/api/router"
log "github.com/sirupsen/logrus"
)
func main() {
Formatter := new(log.TextFormatter)
Formatter.TimestampFormat = "02-01-2006 15:04:05"
Formatter.FullTimestamp = true
log.SetFormatter(Formatter)
db, err := sqlx.Connect("postgres", "user=postgres password=test host=0.0.0.0 dbname=citadel sslmode=disable")
if err != nil {
log.Panic(err)
}
defer db.Close()
fmt.Println("starting graphql server on http://localhost:3333")
fmt.Println("starting graphql playground on http://localhost:3333/__graphql")
r, _ := router.NewRouter(db)
http.ListenAndServe(":3333", r)
}

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"github.com/jordanknott/project-citadel/api/router"
"time"
)
func main() {
dur := time.Hour * 24 * 7 * 30
token, err := router.NewAccessTokenCustomExpiration("21345076-6423-4a00-a6bd-cd9f830e2764", dur)
if err != nil {
panic(err)
}
fmt.Println(token)
}