initial commit
This commit is contained in:
28
api/cmd/citadel/main.go
Normal file
28
api/cmd/citadel/main.go
Normal 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)
|
||||
}
|
16
api/cmd/citadelctl/main.go
Normal file
16
api/cmd/citadelctl/main.go
Normal 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)
|
||||
}
|
Reference in New Issue
Block a user