joeygql
v0.0.3
Published
Use it as a wrapper above the Hasura-GraphQL engine
Downloads
39
Readme
joeygql
This is used as a additional supportive library above hasura-graphql-engine (open-source)
Documentation
Then make a table (postgres)
CREATE TABLE public.user_auth (
id serial NOT NULL,
h_id text NOT NULL,
auth_token text NOT NULL,
"role" text NOT NULL DEFAULT 'user'::text,
CONSTRAINT user_auth_auth_token_key UNIQUE (auth_token),
CONSTRAINT user_auth_h_id_key UNIQUE (h_id),
CONSTRAINT user_auth_id_key UNIQUE (id),
CONSTRAINT user_auth_pkey PRIMARY KEY (id, h_id)
);
- metadata.json (hasura)
{"functions":[],"remote_schemas":[],"query_collections":[],"allowlist":[],"tables":[{"table":"user_auth","object_relationships":[],"array_relationships":[],"insert_permissions":[{"role":"google","comment":null,"permission":{"set":{},"check":{},"columns":["auth_token","h_id","role"]}}],"select_permissions":[{"role":"google","comment":null,"permission":{"allow_aggregations":false,"columns":["auth_token","h_id","id","role"],"filter":{"h_id":{"_eq":"X-HASURA-USER-H-ID"}}}}],"update_permissions":[{"role":"google","comment":null,"permission":{"set":{},"columns":["auth_token","role"],"filter":{"h_id":{"_eq":"X-HASURA-USER-H-ID"}}}}],"delete_permissions":[],"event_triggers":[]}],"query_templates":[]}
- Install
npm -i joeyql
- Import module
const joeygql = require('joeygql');
- Set hasura graphql url
joeygql.setHasuraGraphqlUrl("<HASURA_GRAPHQL_URL>","<HASURA_GRAPHQL_ACCESS_KEY>");
- Set hasura graphql url
joeygql.setHasuraGraphqlUrl("<HASURA_GRAPHQL_URL>","<HASURA_GRAPHQL_ACCESS_KEY>");
joeygql.setGoogleApiClientId("<GOGGLE_CLIENT_ID>");
joeygql.setCloudinaryUrl("<CLOUDINARY_API_ID>")
- If you are using express then this is how you use sign in
router.post('/sign_in', function (req, res, next) {
joeygql.signInGoogle(req.body.id_token).then(data => res.json(data)).catch(e => res.json(e));
});
Changelog
Contributing
We're looking for co-maintainers! If you want to become a master of time please write to joeydash.
In addition to contributing code, you can help to triage issues. This can include reproducing bug reports, or asking for vital information such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to subscribe to moment/moment on CodeTriage.
License
Moment.js is freely distributable under the terms of the MIT license.