[GH-ISSUE #24] Example with http request #112

Closed
opened 2026-03-15 11:32:21 +03:00 by kerem · 1 comment
Owner

Originally created by @derit on GitHub (Aug 23, 2019).
Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/24

how to using other http request, if not using axios ?
https://github.com/request/request

Originally created by @derit on GitHub (Aug 23, 2019). Original GitHub issue: https://github.com/atulmy/gql-query-builder/issues/24 how to using other http request, if not using axios ? https://github.com/request/request
kerem 2026-03-15 11:32:21 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@atulmy commented on GitHub (Aug 25, 2019):

Not very sure, but it should look something like this:

import request from "request";
import { query } from "gql-query-builder";

async function getThoughts() {
  try {
    const response = await request.post(
      "http://api.example.com/graphql",
      {form: query({
        operation: "thoughts",
        fields: ["id", "name", "thought"]
      })}
    );
   
    console.log(response);
  } catch (error) {
    console.log(error);
  }
}
<!-- gh-comment-id:524606235 --> @atulmy commented on GitHub (Aug 25, 2019): Not very sure, but it should look something like this: ```javascript import request from "request"; import { query } from "gql-query-builder"; async function getThoughts() { try { const response = await request.post( "http://api.example.com/graphql", {form: query({ operation: "thoughts", fields: ["id", "name", "thought"] })} ); console.log(response); } catch (error) { console.log(error); } } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gql-query-builder#112
No description provided.