This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@rayhanadev/replit-gql
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

Replit GraphQL

Reusable function to query Replit's GraphQL API. Written to consume @apollo/client with a patched node-fetch used by Replit.

It is recommended you add babel-plugin-import-graphql to your Babel configuration to import .graphql files. Otherwise you may use graphql-tag to the same effect.

For information on how to use the ApolloClient, visit its core API docs. Note, this package uses the core ApolloClient, not the React view layer.

Usage

import { GraphQL } from '@rayhanadev/replit-gql';
import CurrentUser from './queries/CurrentUser.graphql';

// You can use a Replit Token
// (connect.sid) for authenticated
// queries.
const { REPLIT_TOKEN } = process.env;
const client = GraphQL(REPLIT_TOKEN);

const { data } = await client.query({
  query: CurrentUser,
});

console.log(data);

Output:

{
  "currentUser": {
    "id": 4045907
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i @rayhanadev/replit-gql

Homepage

http:

Weekly Downloads

3

Version

1.2.1

License

MIT

Unpacked Size

626 kB

Total Files

8

Last publish

Collaborators

  • rayhanadev