You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
app.listen(4000);
console.log("Running a GraphQL API server at http://localhost:4000/graphql");
`
Context is undefined, i tried every syntax put something into the context and it is always undefined, please help me
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
`var express = require("express");
var { createHandler } = require("graphql-http/lib/use/express");
var { ruruHTML } = require("ruru/server");
import typeDefs from "./graphql/schema";
import resolvers from "./graphql/resolvers";
import { PrismaClient } from "@prisma/client";
var db = new PrismaClient();
var app = express();
app.all(
"/graphql",
createHandler({
schema: typeDefs,
rootValue: resolvers,
context: () => ({ db }),
})
);
app.get("/", (_req: any, res: any) => {
res.type("html");
res.end(ruruHTML({ endpoint: "/graphql" }));
});
app.listen(4000);
console.log("Running a GraphQL API server at http://localhost:4000/graphql");
`
Context is undefined, i tried every syntax put something into the context and it is always undefined, please help me
Beta Was this translation helpful? Give feedback.
All reactions