Log in to GraphQL Editor
Docs
Projects Cloud

Examples | Stucco GraphQL server

This example shows a simple GraphQL schema with one string field resolver:

schema.graphql

type Query{
    hello: String
}
schema{
    query: Query
}

stucco.json

{
    "resolvers":{
        "Query.hello":{
            "resolve":{
                "name": "lib/hello"
            }
        }
    }
}

hello.js

export function handler(input){
    return "Hello world"
}

When the following query is executed:

{
    hello
}

It should yield this response:

{
    "hello": "Hello world"
}