분류 Nodejs

gotql - got에 내장 된 GraphQL 요청 라이브러리.

컨텐츠 정보

  • 조회 271 (작성일 )

본문

https://github.com/khaosdoctor/gotql


GotQL 



const gotQl = require('gotql')

const query = {
  operation: {
    name: 'users',
    fields: ['name', 'age', 'id']
  }
}

const options = {
  headers: {
    "Authorization": "Bearer <token>"
  },
  debug: false
}

gotQL.query('mygraphqlendpoint.com.br/api', query, options)
  .then(response => console.log(response.data))
  .catch(console.error)