My Roadmap to practise graphql with different technologies and discover different libraries
- Spring Boot Graphql
- Nodejs Graphql
- Apollo server
- Apollo client
- Angular Github Graphql API
- Prisma
- React Relay
- Other ..
Maven dependncies :
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-spring-boot-starter</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-tools</artifactId>
<version>5.2.4</version>
</dependency>
GraphQL Schema :
type Vehicle
{
id: ID!,
type: String,
modelCode: String,
brandName: String,
launchDate: String
}
type Query {
vehicles(count: Int):[Vehicle]
vehicle(id:ID):Vehicle
}
type Mutation
{
createVehicle(type: String!, modelCode: String!, brandName: String, launchDate: String):Vehicle
}
Query Resolver :
@Component
public class VehicleQuery implements GraphQLQueryResolver {
Mutation :
public class VehicleMutation implements GraphQLMutationResolver {
@Autowired
private VehicleService vehicleService;
public Vehicle createVehicle(final String type, final String modelCode, final String brandName, final String launchDate) {
return this.vehicleService.createVehicle(type, modelCode, brandName, launchDate);
}
}
npm dependncies :
"dependencies": {
"express": "^4.17.1",
"express-graphql": "^0.9.0",
"graphql": "^15.0.0"
}
GraphQl Schema :
// Build the schema //
var schema = buildSchema(
`
type Query {
hello:String
}
`
)
GraphQl Resolver:
var root = {
hello: () => {
return 'Hello world!';
},
};