**My goal:** Create a Windows form app that queries via GraphQl to an existing online database.

**What I've done:** 

* To simulate a graphQl server I've followed the official [graphql-node Tutorial](https://www.howtographql.com/graphql-js/0-introduction/) till the end. So now I'm able to query from the GraphQl playground and get a response. This server runs on localhost:4000.
* I've created a windows form app in Visual Studio that queries in graphQl to an internal database containing mocked data. E.g.

My **Form.cs** class contains this code, where I execute the query onButtonClick

```
    private void button1_Click(object sender, EventArgs e)
    {
        var schema = Schema.For(@"
            type Jedi {
                name: String,
                side: String,
                id: ID
            }
            type Query {
                hello: String,
                jedis: [Jedi],
                jedi(id: ID): Jedi
            }", _ => { _.Types.Include<Query>(); }
        );

        var json = schema.Execute(_ =>
        {
            _.Query = "{jedis { name, side } }";
        });

        System.Diagnostics.Debug.WriteLine(json);

        label1.Text = json;
    }

```

After I execute the query my **Query.cs** class will recognize it and resolve the query 

```
class Query
{
    [GraphQLMetadata("jedis")]
    public IEnumerable<Jedi> GetJedis()
    {
        return StarWarsDB.GetJedis();
    }
}

```

This is my Current internal DB

```
class StarWarsDB
{
    public static IEnumerable<Jedi> GetJedis()
    {
        return new List<Jedi>() {
    new Jedi(){ Id = 1, Name ="Luke", Side="Light"},
    new Jedi(){ Id = 2, Name ="Yoda", Side="Light"},
    new Jedi(){ Id = 3, Name ="Darth Vader", Side="Dark"}
};
    }
}

```

**The next step i want to do:** 

Now, I've found a lot of examples online on how to query a db but they were always made internally in visual Studio. What I wanted to do is connecting to my personal DB running on my localHost for now (the one i made following the [graphql-node Tutorial](https://www.howtographql.com/graphql-js/0-introduction/)) and query it with graphQl. Then take the JSON response and print it somewhere.