const {ApolloServer, gql} = require(‘apollo-server’);
const typeDefs = gql`
type User{
name: String
age: Int
position: String
}
type Query{
users:[User]
}
`
let users = [
{
name:”New”,
age:”22″,
position:”student”
},
{
name:”New2″,
age:”23″,
position:”teacher”
},
{
name:”New3″,
age:”24″,
position:”ta”
},
]
const resolvers = {
Query:{
users: () => users
}
}
const server = new ApolloServer({typeDefs, resolvers});
server.listen().then(({url})=>{
console.log(`sever ready at port ${url}`)
})