-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docs are outdated #409
Comments
Thanks @ighormartins yes absolutely, I'm using this is multiple production applications works really well and up to date. I need to put in more the docs / readme and some examples too, I would add this in the next few days. Meanwhile if you have any specific question feel free to ask, also you could look at demo apps it have multiple real use cases tested and shows how to use it. Also please feel free to updated any docs or content that you think it's missing and I will incorporate it |
There are 3 main things bothering me right now (in order of how easy -> hard it'd be to contribute to the lib):
|
export const gqLtsClient = createClient({
url: 'http://localhost:3000/graphql',
});
// example of interceptor
gqLtsClient?.fetcherInstance?.interceptors.request.use(
(config) => {
if (!config.headers || !config.headers['content-type']) {
config.headers = {
...config.headers,
'content-type': 'application/json',
};
}
return config;
},
);
import supertest from 'supertest';
import { extractFiles } from '@gqlts/runtime/dist/extract-files/extract-files';
const app = express();
export const request = supertest(expressApp);
export const supertestGQLClient = createClient({
fetcherInstance: request,
fetcherMethod: async (operation, config) => {
const r = request.post('/graphql');
const { clone, files } = extractFiles(operation);
if (files.size > 0) {
// 1. First document is graphql query with variables
r.field('operations', JSON.stringify(clone));
// 2. Second document maps files to variable locations
const map: any = {};
let i = 0;
files.forEach((paths) => {
map[i++] = paths;
});
r.field('map', JSON.stringify(map));
// 3. all files not (same index as in map)
let j = 0;
for (const [file] of files) {
r.attach(`${j++}`, file, { filename: file.name });
}
}
const { headers = {} } = config || {};
r.set('Content-Type', 'application/json').set('Accept', 'application/json');
for (const [key, value] of Object.entries(headers)) {
r.set(key, String(value));
}
if (files.size) {
r.type('form');
} else {
r.send(JSON.stringify(operation));
}
return r
.expect(200)
.then((response) => {
return response.body;
})
.catch((e) => {
return { errors: [{ message: e.message, path: ['client'] }] };
});
},
}); |
Thank you! Do you think the alias is possible to solve? From what I'm thinking, the types is going to be very hard. I didn't even know you were supporting file upload :) |
Hi there.
I've been looking at your repo for a while. Love GenQL but like the direction you're taking even more.
However I noticed you've made some changes and added some features but the docs are not update.
Could you please update the docs? Having a website is not necessary if it's too much trouble, just keep it in the README if it's easier.
I'd love to have the docs update so I can start contributing .
The text was updated successfully, but these errors were encountered: