# Resolvers

Resolvers are files or named exports.&#x20;

#### Default export

```typescript
export default (input) => {
    return  "Hello world"
}
```

#### Handler export

```typescript
export const handler = (input) => {
    return "Hello world"
}
```

#### Named export

```typescript
export const (input) => {
    return "Hello world"
}
```

```json
{
    "resolvers":{
        "RESOLVER_TYPE.RESOLVER_FIELD":{
            "resolve":{
                "name": "PATH_TO_RESOLVER.someName"
            }
        }
    }
}
```

#### Passing arguments to another resolver:

**Resolver "Query.todoOperations"**

{% code title="schema.graphql" %}

```graphql
type TodoOperations{
    getCreditCardNumber(id: String!): String
    showMeTehMoney: Int
}

type Query{
    todoOps: TodoOperations
}
```

{% endcode %}

{% code title="stucco.json" %}

```json
{
    "resolvers":{
        "Query.todoOps":{
            "resolve":{
                "name": "lib/todoOps"
            }
        },
        "TopoOps.getCreditCardNumber":{
            "resolve":{
                "name": "lib/getCreditCardNumber"
            }
        }
    }
}
```

{% endcode %}

{% code title="lib/todoOps.js" %}

```typescript
export default (input) => {
    return {
        creditCards:{
            dupa: "1234-1234-1234-1234",
            ddd: "1222-3332-3323-1233"
        }
    }
}
```

{% endcode %}

{% code title="lib/getCreditCardNumber.js" %}

```typescript
export default (input) => {
    const { id } = input.arguments
    return {
        response: input.source.creditCards[id]
    }
}
```

{% endcode %}

###

###


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.graphqleditor.com/tools/stucco-js/resolvers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
