Skip to content

Commit 59e9e69

Browse files
committed
Some changes
1 parent 75340e3 commit 59e9e69

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

graphQL/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import express from "express";
2-
import graphqlHTTP from "graphql-express"
2+
import { createHandler } from 'graphql-http/lib/use/express';
33
import schema from "./data/schema.js";
44

55
const app = express()
@@ -10,13 +10,12 @@ app.get('/', (req, res) => {
1010
res.send("GraphQL")
1111
})
1212

13-
const root = { hello: () => "Hi form graphql" }
13+
const root = { hello: () => "Hi from graphql" }
1414

15-
app.use('/graphql', graphqlHTTP({
15+
app.all('/graphql', createHandler({
1616
schema: schema,
1717
rootValue: root,
18-
graphiql: true,
19-
}))
18+
}));
2019

2120
app.listen(PORT, ()=> {
2221
console.log(`Running server at: ${PORT}`)

graphQL/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
"author": "Nikos Konstantakis",
1313
"license": "ISC",
1414
"dependencies": {
15+
"babel-node": "^0.0.1-security",
1516
"express": "^4.19.2",
1617
"graphql": "^16.8.1",
17-
"graphql-express": "^3.0.0"
18+
"graphql-express": "^3.0.0",
19+
"graphql-http": "^1.22.1"
1820
},
1921
"devDependencies": {
2022
"@babel/cli": "^7.24.1",

0 commit comments

Comments
 (0)