Skip to content

Commit 8821751

Browse files
committed
Add typescript example
1 parent 11fc70d commit 8821751

File tree

3 files changed

+1026
-0
lines changed

3 files changed

+1026
-0
lines changed

example/node/package.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "node",
3+
"private": true,
4+
"license": "MIT",
5+
"dependencies": {
6+
"express": "^5.1.0",
7+
"json-graphql-server": "../../"
8+
}
9+
}

example/node/server.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import express from 'express';
2+
import jsonGraphqlExpress, { getPlainSchema } from 'json-graphql-server/node';
3+
import data from '../data.cjs'
4+
5+
const PORT = 3000;
6+
const app = express();
7+
8+
const plainSchema = getPlainSchema(data);
9+
10+
app.use('/graphql', jsonGraphqlExpress(data));
11+
app.listen(PORT);

0 commit comments

Comments
 (0)