Getting Started with GraphQL

I am trying to make a graphical jQuery backend for my web application using Spring MVC, and that I will include it in maven or gradle while everything is sorted.

It looks like I tried everything to get the backend and it works, but I can not figure it out.

I tried todomvc-relay-java , and when you run the app, I just got 415 Unsupported Media Type / x-www- form-urlencoded when you try to scheme and zero results when trying to get todo or user.

I also tried spring-boot-starter , where I cannot get the dependency correctly, trying to include it in the project and when I include .jar files, I get an error because it cannot find the imported classes. When I try to start the project, since it is in the terminal with gradle bootRun, it is stuck 95%, and when I export it as a war file, I can start the grapiql graphic image file, but I can not make any queries. If I try to run only the sample application in the terminal, it complains about the lack of packages that are in the parent folder.

Does anyone know what I'm doing wrong? I fell like a moron when I can’t even prepare a finished project. Are there any easy tips on getting started or something out there that I missed? I googled so much, but still can't find anything that makes me run. I'm starting to think it's me, which is stupid.

+4
source share
3 answers

When running todomvc-relay-java, use this to get the circuit using httpie:

echo '{"query": "{ __schema { types { name }}}", "variables": {}}' | http post localhost:8080/graphql

Or for curl:

curl -XPOST -H 'Content-Type:application/json' -d '{"query": "{ __schema { types { name }}}", "variables": {}}' localhost:8080/graphql

+1
source

spring -boot graphql-java, : https://github.com/graphql-java/graphql-spring-boot. , GitHub.

0

GraphQL-SpringBoot java gradle, spring -jpa, spring -boot mongo, API GraphQL, CRUD .

PS: Postman API .

0

Source: https://habr.com/ru/post/1648855/


All Articles