bee-gorm-graphql
bee-gorm-graphql copied to clipboard
Unable to create user via GraphiQL during setup
According to the README, I should be able to create the first user via GraphiQL, however, the only thing returned is the HTML login page.
I have run:
$ go get github.com/zohararad/bee-gorm-graphql
$ cd $GOPATH/src/github.com/zohararad/bee-gorm-graphql
$ yarn install
$ glide up
$ go get github.com/beego/bee
$ npm run build
$ bee run
I have created the development database. And then attempt to create the first user.
GraphiQL query:
mutation {
createUser(firstName: "Bob", lastName: "Smiith", email: "[email protected]", password: "graphql") {
firstName
lastName
email
}
}
Response:
"<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <title>Bee-Gorm-GraphQL | Welcome</title>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"/assets/app.css\" />\n <link href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500,700\" rel=\"stylesheet\" />\n</head>\n<body>\n <section>\n <form method=\"post\" action=\"/session/login\">\n <input type=\"hidden\" name=\"_xsrf\" value=\"UjTinC0B5e6Ac9bhZsHTWvxNGQzF45X2\" />\n <div class=\"columns is-centered\">\n <div class=\"column is-one-third\">\n <header class=\"has-text-centered\">\n <h1 class=\"title is-2\">Please Login</h1>\n </header>\n </div>\n </div>\n <div class=\"columns is-centered\">\n <div class=\"column is-one-third\">\n <div class=\"card is-fullwidth\">\n <div class=\"card-content\">\n <div class=\"container\">\n <div class=\"control is-horizontal\">\n <div class=\"control-label\">\n <label class=\"label\">Email</label>\n </div>\n <p class=\"control\">\n <input class=\"input\" name=\"email\" type=\"email\" placeholder=\"Email\">\n </p>\n </div>\n <div class=\"control is-horizontal\">\n <div class=\"control-label\">\n <label class=\"label\">Password</label>\n </div>\n <p class=\"control\">\n <input class=\"input\" name=\"password\" type=\"password\" placeholder=\"Password\">\n </p>\n </div>\n <div class=\"control is-clearfix\">\n <button type=\"submit\" class=\"button is-danger is-pulled-right\">Login</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </form>\n</section>\n</body>\n</html>"
I saw the same issue, is this solved?
I tried make a CURL
curl -XPOST http://localhost:8080/query -d 'mutation {createUser(firstName: "Bob", lastName: "Smiith", email: "[email protected]", password: "graphql"){id}}'
to the query route:
beego.Router("/query", &controllers.GraphqlController{}, "post:Query")
and it doesn't work as well.