server.js
422 Bytes
import { GraphQLServer } from "graphql-yoga";
import dotenv from "dotenv";
dotenv.config();
const PORT = process.env.PORT || 4000;
const typeDefs = `
type Query {
hello(name: String): String
}
`;
const resolvers = {
Query: {
hello: () => "hello",
},
};
const server = new GraphQLServer({ typeDefs, resolvers });
server.start(() => console.log(`server is running : http://localhost:${PORT}`));