1

I am trying to create an angular project with .net core 2.1 with GraphQL library. I am totaly new in PostgresSQL, GraphQL & PostGraphile. So, just want to know is it possible to use PostGraphile with my angular .net core project. I have added a package for GraphQL but, didn't find the package for PostGraphile. Angular is not neccesary for me if I can create a project with react.net then it would be ok.

Shell
  • 6,818
  • 11
  • 39
  • 70

2 Answers2

1

Postgraphile is available as a CLI and a Node.js library.

For your project, you can set up the GraphQL server using either, and possibly build up on it in your .NET application using schema stitching.

anukul
  • 1,922
  • 1
  • 19
  • 37
0

I am using postgraphile in my Asp.net project and I send HttpClient request to communication.

public class TestController : ControllerBase
{
    private readonly IHttpClientFactory _httpClient;

    public TestController(IHttpClientFactory httpClient)
    {
        _httpClient = httpClient;
    }


    [HttpPost("get-all")]
    public async Task<YourViewModel> GetAll([FromBody] Input query)
    {
        var requestUri="http://localhost:5000/graphql"; //postgraphile Ip address
        var content = new StringContent(query.Query, Encoding.UTF8, "application/graphql");
        var response = await _httpClient.CreateClient().PostAsync(requestUri, content);
        string resultContent = await response.Content.ReadAsStringAsync();
        return JsonConvert.DeserializeObject<YourViewModel>(resultContent);
    }
}

public class Input
{
    public string Query { get; set; }
}
Mohammad Almasi
  • 400
  • 6
  • 19