Log in to GraphQL EditorGet started
Docs
Introduction
Desktop app
External Tools
CLI

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"
}