Moving beyond REST: GraphQL and Java & Spring by Pratik Patel @ Spring I/O 2019
Вставка
- Опубліковано 20 лип 2024
- Spring I/O 2019 - Barcelona, 16-17 May
We’ve been using REST-based API development for over a decade now. While it provides a contract for both API developers and API consumers, it can be big, rigid and brittle. GraphQL can be used to either augment or replace REST based endpoints to provide faster and more flexible development. In this session, we’ll discuss GraphQL basics and look at how we create a GraphQL server and consume it in a client, using Java, of course! We will also show how easy it is to mix GraphQL into an existing Spring Boot application. - Наука та технологія
Rly nice, thank you for this presentation. Link to your demo would be helpful. Thanks!
Would have been useful to see how the Java spring boot application was created, did you use Initializr for example? what dependancies did you start with, etc.
how did you implement the 'first:1' in the filmConnection ? (11.00 min)
con you give provide a link to this code on git
Can you please share the link to github for the demo apps?
is there any example where filters are passed from the client and GraphQL responds with filtered data?
Very nice presentation, but the project is not in your github. Are you able to upload your demo project to your github repo ?
You can find a similar example in this repository: github.com/NoorKrichen/GrphQL-Spring-Example
Really a nice video.Can you please share the github repo for java+ graphql
code?
I google another tutorial www.baeldung.com/spring-graphql not from this video
Thanks for this wonderful tutorial. is it possible to customize the graphql response format like following ?
{
"data":{},
"info": {},
"audit": {},
"error": {}
}
You could do that with spring aspects
Jason Buchanan Could you please tell how this can be achieved? Please share if you have any reference
@@sumanthvarada so an aspect is something that happens at some point in any function that fits a given criteria and can manipulate data or the state of your thread. It's usually used for logging but in this case you can feed it your output using an after annotation from any function in your class and have it parsed any way you want.
howtodoinjava.com/spring-aop/aspectj-after-annotation-example/
However that violates the point of this whole thing and your going back to almost rewrapping your graph but for rest just to get this data format that doesn't make sense to work. Ie the client should never see any audit or info and an error is a code greater than or equal to 400 with no data but a message
You can find a similar example in this repository: github.com/NoorKrichen/GrphQL-Spring-Example
How to add jwt suport in graphql?
Jwt should be in your http header, you can find more by looking in Spring Security documentation.