Slide 139
Slide 139 text
const permissions = shield({
Query: {
frontPage: not(isAuthenticated),
events: and(isAuthenticated, or(isAdmin, isEditor)),
},
Mutation: {
createEvent: isAuthenticated,
},
});
const server = new GraphQLServer({
typeDefs,
resolvers,
middlewares: [permissions],
context: (req) => ({
...req,
user: getUser(req),
}),
});
@samjulien