Registry / api-client / graphql-express

graphql-express

JSON →
library3.0.1jsnpmunverified

A lightweight GraphQL client built on RxJS observables, allowing GraphQL queries and mutations to be managed with reactive operators like switchMap, mergeMap, and exhaustMap. Current stable version 3.0.1 targets RxJS 7.x. Unlike Apollo Client, it focuses on simplicity and cancellability via observables, with built-in query builder support for fragments and variables. Ships TypeScript types.

npm install graphql-express
INSTALL
IMPORT
SIG · GRAPHQL-EXPRESS
G
graphql-express
api-clientjavascriptv3.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

query
import { query } from 'graphql-express'
const query = require('graphql-express').query
ESM import only; CommonJS require() works but is not the recommended pattern.
mutation
import { mutation } from 'graphql-express'
import { Mutation } from 'graphql-express'
Function name is lowercase 'mutation', not PascalCase.
QueryBuilder
import { QueryBuilder } from 'graphql-express'
import { queryBuilder } from 'graphql-express'
Class name is PascalCase 'QueryBuilder'.

Shows a basic GraphQL query using the query function, handling the response and errors with RxJS operators.

import { query } from 'graphql-express'; import { catchError, map } from 'rxjs/operators'; const REQUEST_URL = process.env.GRAPHQL_ENDPOINT ?? 'https://api.example.com/graphql'; const usersQuery = `{ allUsers { id name } }`; query(REQUEST_URL, usersQuery).pipe( map((response: any) => response.data?.allUsers || []), catchError((err: any) => { throw new Error(`GraphQL error: ${err.message}`); }) ).subscribe({ next: (users) => console.log('Users:', users), error: (err) => console.error(err) });
Debug
Known issues
breakingRxJS peer dependency changed from v6 to v7 in version 3.0.0.
fix
Update rxjs to ^7.8.2 in your project.
affects: >=3.0.0
deprecatedApollo compatible output is no longer supported.
fix
Use the new simplified query/mutation result format directly. If you need Apollo-like structure, migrate to Apollo Client.
affects: >=3.0.0
gotchaThe library does not handle authentication or headers automatically; you must pass them via the optional 'options' parameter.
fix
Add headers in the options object: { headers: { Authorization: `Bearer ${token}` } }
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'graphql-express'
Library not installed or missing peer dependency rxjs.
fix
Run: npm install graphql-express rxjs
TypeError: query(...).pipe is not a function
You are using a non-Observable result, likely because of an outdated RxJS version or incorrect import.
fix
Ensure rxjs ^7.8.2 is installed and import 'query' correctly: import { query } from 'graphql-express'
GraphQL error: Network error: Failed to fetch
The endpoint URL is incorrect, or there was a network issue (CORS, throttling).
fix
Verify the REQUEST_URL, check CORS settings, and if using a browser, ensure the endpoint allows cross-origin requests.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
rxjsrequiredPeer dependency: Provides the Observable core and operators used for all GraphQL request handling.
Agent activity
44 hits · last 30 days
node
38
Amazon
1
OpenAI (training)
1
Resources
graphql-express — npm install graphql-express · libregistry