> For the complete documentation index, see [llms.txt](https://abi.gitbook.io/net-core/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abi.gitbook.io/net-core/6.3-agregar-graphql/8.1.3-configurando-y-probando-graphql.md).

# 8.1.3 Configurando y probando graphQL

Una vez que tenemos el query lo vamos a agregar en la clase Startup.cs en el método ConfigureServices agregamos Graph (GraphQLServer), agregamos nuestra clase Query (AddQueryType\<Query>) y agregamos las opciones que utilizaremos en este caso AddProjections(), AddFiltering() y AddSorting()

{% code title="Startup.cs" %}

```csharp
public void ConfigureServices(IServiceCollection services)
{
   //Código
   services.AddGraphQLServer()
           .AddQueryType<Query>().AddProjections()
           .AddFiltering().AddSorting()
```

{% endcode %}

En el método configure agregamos la ruta para acceder a grapQL en la parte de app.UseEndpoints

{% code title="Startup.cs" %}

```csharp
public void Configure(IApplicationBuilder app,
                     IWebHostEnvironment env, 
                     ILogger<Startup> logger)
{    
    //Código
    app.UseEndpoints(endpoints =>
    {
        endpoints.MapControllers();
        endpoints.MapGraphQL("/graphql");
    });
```

{% endcode %}

Ya viene configurado con una opción para consultar tus servicios llamado [Banana Cake Pop](https://chillicream.com/docs/bananacakepop). El cual puedes acceder desde <http://localhost:5000/grapqhl\\>
\
Da clic en Browse Schema para ver la definición del esquema y probar

&#x20;![](/files/hlnqZSnH1W1Ctve0sjaB)

Puedes configurar mas opciones como la autenticación. Da clic en Apply

![](/files/VBcUmIIEFh1TkXQepicH)

Da  clic en el tab **Operations** y Agrega lo siguiente para traer algunos campos de la tabla caducidad

```graphql
query TestQuery {
  caducidad(order: { fecha: ASC }) {
    id
    fecha
    producto {
      nombre
    }
    cliente {
      id
      nombreComercial
      razonSocial
    }
  }
}
```

![](/files/4vzmMDHmM6k3q7BLDDLV)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://abi.gitbook.io/net-core/6.3-agregar-graphql/8.1.3-configurando-y-probando-graphql.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
