Added experimental GraphQL server

This commit is contained in:
2019-05-10 17:36:39 +09:00
parent 3923d6bfbf
commit a42c5be666
8 changed files with 65 additions and 487 deletions

@ -4,6 +4,7 @@ import (
"strings"
"github.com/aerogo/aero"
"github.com/aerogo/graphql"
nanostore "github.com/aerogo/session-store-nano"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/auth"
@ -12,10 +13,9 @@ import (
"github.com/animenotifier/notify.moe/utils/routetests"
)
var app = aero.New()
func main() {
// Configure and start
app := aero.New()
configure(app).Run()
}
@ -60,6 +60,9 @@ func configure(app *aero.Application) *aero.Application {
// Authentication
auth.Install(app)
// GraphQL
app.Post("/api", graphql.Handler(arn.DB))
// Close the database node on shutdown
app.OnEnd(arn.Node.Close)