Registry / api gateway / wapplr-graphql

wapplr-graphql

JSON →
library2.0.1jsnpmunverified

GraphQL extension for the Wapplr framework, version 2.0.1. Provides middleware to integrate GraphQL endpoints into Wapplr server and client applications. Release cadence is irregular; latest version published in 2021. Key differentiator: tightly coupled with Wapplr, leveraging its middleware system and global configuration. Supports Node.js >=12 and is ESM-only.

npm install wapplr-graphql
INSTALL
IMPORT
SIG · WAPPLR-GRAPHQL
W
wapplr-graphql
api gatewayjavascriptv2.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.

default
import wapplrGraphql from 'wapplr-graphql'
const wapplrGraphql = require('wapplr-graphql')
Package is ESM-only; default export is a function.
createMiddleware
import { createMiddleware as createWapplrGraphqlMiddleware } from 'wapplr-graphql'
Named export for creating the middleware; used in server setup.
require (CJS)
const wapplrGraphql = (await import('wapplr-graphql')).default; const { createMiddleware } = await import('wapplr-graphql');
const wapplrGraphql = require('wapplr-graphql'); const { createMiddleware } = require('wapplr-graphql');
CommonJS require not directly supported; use dynamic import.

Sets up a Wapplr server with GraphQL middleware on /graphql endpoint.

import wapplrGraphql, { createMiddleware as createWapplrGraphqlMiddleware } from 'wapplr-graphql'; import wapplrServer from 'wapplr'; const wapp = wapplrServer({config: { server: { disableUseDefaultMiddlewares: true, graphql: { route: '/graphql' } }, globals: { WAPP: 'yourBuildHash', ROOT: __dirname } }}); wapplrGraphql({wapp: wapp}); const app = wapp.server.app; app.use([ wapp.server.middlewares.wapp, wapp.server.middlewares.static, createWapplrGraphqlMiddleware({wapp: wapp}), ...Object.keys(wapp.server.middlewares).map(key => (key === 'wapp' || key === 'static') ? (req, res, next) => next() : wapp.server.middlewares[key] ) ]); wapp.server.listen();
Debug
Known issues
gotchaMust register middleware manually; does not work with default middlewares enabled.
fix
Set disableUseDefaultMiddlewares: true in server config and manually add middlewares.
affects: all
breakingESM-only, no CommonJS support.
fix
Use import syntax or dynamic import in CommonJS environments.
affects: >=2.0.0
deprecatedPackage is stale; last release 2021, no recent updates.
fix
Consider alternatives like express-graphql or Apollo Server.
affects: all
gotchaRequires graphql as a peer dependency.
fix
Install graphql package in your project.
affects: all
Errors
Common errors & fixes
Cannot find module 'wapplr-graphql'
Package not installed or wrong import path.
fix
Run npm install wapplr-graphql and verify import statement.
createMiddleware is not a function
Incorrect import of createMiddleware.
fix
Use import { createMiddleware } from 'wapplr-graphql' (named export).
require is not defined in ES module scope
Trying to use require() in an ESM context.
fix
Use import statements or dynamic import instead of require.
Upgrade
Version history
2.0.1latest on npm
Audit
Dependencies
graphqloptionalPeer dependency for GraphQL functionality
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
wapplr-graphql — npm install wapplr-graphql · libregistry