A simple example demonstrating the GraphQL extension for Forge.
cd v2/examples/graphql-basic
go run main.go- GraphQL API: http://localhost:8080/graphql
- Playground: http://localhost:8080/playground
# Hello query
curl -X POST http://localhost:8080/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{ hello(name: \"World\") }"}'
# Version query
curl -X POST http://localhost:8080/graphql \
-H "Content-Type: application/json" \
-d '{"query":"{ version }"}'
# Echo mutation
curl -X POST http://localhost:8080/graphql \
-H "Content-Type: application/json" \
-d '{"query":"mutation { echo(message: \"Hello GraphQL\") }"}'Visit http://localhost:8080/playground and try:
query {
hello(name: "Forge")
version
}
mutation {
echo(message: "Testing mutations")
}- ✅ Query operations
- ✅ Mutation operations
- ✅ GraphQL Playground
- ✅ Automatic schema generation
- ✅ Type-safe resolvers
- ✅ Metrics and logging
- ✅ Query caching