Automatically generate a RESTful API from your existing GraphQL API. This Node.js library reads your GraphQL schema and a user-provided manifest file to generate an Express router with fully RESTful HTTP routes. v1.0.1 is the current stable version, released under MIT license by Sisense. Key differentiators: supports any GraphQL server execution function, customizable endpoints mapping, and allows you to have both GraphQL and REST APIs from a single schema with full control over REST configuration.
npm install graphql2restNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows full setup: generate query files from schema, initialize router with manifest, and mount on Express app.
Ensure generateGqlQueryFiles is called first, typically as a build step or at startup before calling init.
Use graphql's execute function or wrap your custom executor to match the standard signature.
Use path.resolve(__dirname, 'manifest.json') to ensure correct path resolution.
Pin to exact version in package.json and review changelog before upgrading.
Run 'npm install graphql2rest' and ensure your project uses ESM (type: module in package.json or .mjs extension).
Replace 'const GraphQL2REST = require("graphql2rest")' with 'import GraphQL2REST from "graphql2rest"'.Call GraphQL2REST.generateGqlQueryFiles(schema, './gqlFilesFolder') before calling init, or create the folder manually.
Ensure manifest.json exists at the specified path and use absolute path with path.resolve(__dirname, 'manifest.json').