This commit is contained in:
@@ -8,6 +8,8 @@ import (
|
||||
"runtime/debug"
|
||||
|
||||
"git.aiterp.net/rpdata/api/graph2"
|
||||
"git.aiterp.net/rpdata/api/internal/auth"
|
||||
"git.aiterp.net/rpdata/api/internal/loader"
|
||||
"git.aiterp.net/rpdata/api/internal/store"
|
||||
logModel "git.aiterp.net/rpdata/api/model/log"
|
||||
"github.com/99designs/gqlgen/handler"
|
||||
@@ -20,7 +22,15 @@ func main() {
|
||||
}
|
||||
|
||||
http.Handle("/", handler.Playground("RPData API", "/query"))
|
||||
http.Handle("/query", handler.GraphQL(
|
||||
http.Handle("/query", queryHandler())
|
||||
|
||||
go updateCharacters()
|
||||
|
||||
log.Fatal(http.ListenAndServe(":8081", nil))
|
||||
}
|
||||
|
||||
func queryHandler() http.HandlerFunc {
|
||||
handler := handler.GraphQL(
|
||||
graph2.New(),
|
||||
handler.RecoverFunc(func(ctx context.Context, err interface{}) error {
|
||||
// send this panic somewhere
|
||||
@@ -29,11 +39,16 @@ func main() {
|
||||
|
||||
return fmt.Errorf("shit")
|
||||
}),
|
||||
))
|
||||
)
|
||||
|
||||
go updateCharacters()
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
l := loader.New()
|
||||
r = r.WithContext(l.ToContext(r.Context()))
|
||||
|
||||
log.Fatal(http.ListenAndServe(":8081", nil))
|
||||
r = auth.RequestWithToken(r)
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func updateCharacters() {
|
||||
|
||||
Reference in New Issue
Block a user