graphql-rest-wrapper
graphql-rest-wrapper copied to clipboard
How to? - with authorization header
I've got this
const fetchApi = async () =>
fetch(myApiUrl, {
method: 'GET',
headers: {
'authorization': 'Basic RDJXREIzV0ZETTNIOEJLQUc5VkY1UUNLQ1UyUVhLWjU6',
'Accept': 'application/json',
'Content-Type': 'application/json',
}
})
.then(function(response) {
if(response.status == 200) return response.json();
else throw new Error('Parece que ainda não foi!');
})
.then(function(res) {
console.log(res);
});
This is right?
const wrapper = new gqlRestWrapper(myApiUrl, {
method: 'GET',
headers: {
'authorization': 'Basic RDJXREIzV0ZETTNIOEJLQUc5VkY1UUNLQaSaAdUVhLWjU6',
'Accept': 'application/json',
'Content-Type': 'application/json',
},
name: 'MyRestAPI',
generateSchema: true,
saveSchema: true,
graphiql: true
})
I'll have to do this on each end point right? I have more then 20 end points
Thanks!
Best Regards.