Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ You can also use the export `jsonSchemaBuilder` to get your own copy of the Grap
In node:
```js
import {graphql} from 'graphql';
import {jsonSchemaBuilder} from 'json-graphql-server';
import {jsonSchemaBuilder} from 'json-graphql-server/node';

const data = { };
const schema = jsonSchemaBuilder(data);
Expand All @@ -616,7 +616,7 @@ This uses the export `getPlainSchema`.
import { ApolloServer } from 'apollo-server';
import { makeExecutableSchema } from '@graphql-tools/schema'; // or graphql-tools
import { applyMiddleware } from 'graphql-middleware';
import { getPlainSchema } from 'json-graphql-server';
import { getPlainSchema } from 'json-graphql-server/node';

const data = { };

Expand Down
9 changes: 9 additions & 0 deletions example/node/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "node",
"private": true,
"license": "MIT",
"dependencies": {
"express": "^5.1.0",
"json-graphql-server": "../../"
}
}
11 changes: 11 additions & 0 deletions example/node/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import express from 'express';
import jsonGraphqlExpress, { getPlainSchema } from 'json-graphql-server/node';
import data from '../data.cjs'

const PORT = 3000;
const app = express();

const plainSchema = getPlainSchema(data);

app.use('/graphql', jsonGraphqlExpress(data));
app.listen(PORT);
Loading