yojimat / GraphQL-Alura

This repository was created to learn along with the course of GraphQL at [Alura](https://www.alura.com.br/).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphQL Alura

This repository was created to learn along with the course of GraphQL at Alura.

How to use

At the root directory use npx json-server --nc --watch mock-data/data.json to get a data server where you can get data from.
And npm start to start the nodemon server that starts the GraphQL server.

Tools

JSON Server Endpoints

Depending of your firewall rules, you need to put your real ip instead of localhost.

Examples

Requests

Querys

  • curl --request POST --header 'content-type: application/json' --url http://localhost:4000 --data '{"query": "query <opt_query_name> { users { name }}"}'
  • curl --request POST --header 'content-type: application/json' --url http://localhost:4000 --data '{"query": "query {__schema { types { name kind fields { name }}}}"}'

Mutations

curl --request POST \
--header 'content-type: application/json' \
--url http://localhost:4000/ \
--data '{"query":"mutation AddUser($user: AddUserParams!) {\r\n  addUser(user: $user) {\r\n    active\r\n    role {\r\n      id\r\n      type\r\n    }\r\n    name\r\n  }\r\n}","variables":{"user":{"active":false,"name":"test","role":3}}}'

Ideas of Refactoring

  • Create a env file for env variables.

About

This repository was created to learn along with the course of GraphQL at [Alura](https://www.alura.com.br/).


Languages

Language:TypeScript 100.0%