-
npm run start:dev
-
http://localhost:3000/graphql - graphQL playground where we can execute queries and mutations below. (It worked at least before we tried to connect real data base to this project) query { getUserById(id: 3) { id displayName username }
getUsers{ id username settings { userId receiveEmails receiveNotifications } } }
mutation{ createUser(createUserData: { username: "duncan", displayName: "Duncan" }){ id username displayName } }
mutation { createUserSettings(createUserSettingsData: { userId:2 }){ userId receiveEmails receiveNotifications } }
- После подключения Prisma: Start app: npm run start:dev Open http://localhost:3000/graphql Run: mutation { createUser(createUserData: { username: "John", displayName: "John The Actor" }) { id username displayName } }
Then: mutation { createUserSettings(createUserSettingsData: { userId: 1, receiveNotifications: true, receiveEmails: false }) { userId receiveNotifications receiveEmails } }
Query all: query { getUsers { id username displayName settings { userId receiveNotifications receiveEmails } } }