Skip to content

a graphql api to generate random basic info of a person

Notifications You must be signed in to change notification settings

delki8/peoplegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

peoplegen

a graphql api to generate random basic info of a person running at http://peoplegen.herokuapp.com/graphql

try it

open your browser's devtools and type the following

const newPerson = clb => {
  const xhr = new XMLHttpRequest();
  xhr.responseType = 'json';
  xhr.open('POST', 'https://peoplegen.herokuapp.com/graphql');
  xhr.setRequestHeader('Content-Type', 'application/json');
  xhr.setRequestHeader('Accept', 'application/json');
  xhr.onload = () => clb(xhr.response.data.person);
  const query = `{
                    person { 
                      name 
                      email 
                      cpf
                      credits 
                    }
                  }`;
  xhr.send(JSON.stringify({ query }));
};

newPerson(person => console.log(person));

it may take a few seconds to print the person for the first time because we're currently running on a free heroku instance, and it takes a while to start up

About

a graphql api to generate random basic info of a person

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published