{"size": 583, "ext": "js", "max_stars_repo_path": "learntext1/index.js", "max_stars_repo_name": "taopoppy/node-graphql-api", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "learntext1/index.js", "max_issues_repo_name": "taopoppy/node-graphql-api", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "learntext1/index.js", "max_forks_repo_name": "taopoppy/node-graphql-api", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.4230769231, "max_line_length": 52, "alphanum_fraction": 0.6689536878}
const { GraphQLServer } = require('graphql-yoga')
const { db } = require('./db.js')
const { Query } = require('./resolvers/Query')
const { Comment } = require('./resolvers/Comment')
const { Mutation } = require('./resolvers/Mutation')
const { Post } = require('./resolvers/Post')
const { User } = require('./resolvers/User')

// Resolvers(函数实现)
const resolvers= {
	Comment,
	User,
	Post,
	Query,
	Mutation
}

const server = new GraphQLServer({
	typeDefs:'./src/schema.graphql',
	context: {db},
	resolvers
})

server.start(()=> {
	console.log("Server is running on localhost:4000")
})