A lightweight GraphQL service built with Apollo Server for managing user data. This service includes functionality to:
- Retrieve user details by ID.
- Update a user's description.
- Add new users.
getUser(id: ID!): User
Retrieve user details (username, description) by ID.
updateUserDescription(id: ID!, description: String!): User
Update the description of an existing user.addUser(username: String!, description: String!): User
Add a new user to the system.
git clone https://github.com/dkdeptrai/graph_ql_exercise.git
cd graph_ql_exercise
npm install
node server.js
- Visit http://localhost:4000 in your browser.
query {
getUser(id: "1") {
username
description
}
}
mutation ($updateUserDescriptionId: ID!, $description: String!) {
updateUserDescription(
id: $updateUserDescriptionId
description: $description
) {
id
description
}
}
Variables:
{
"id": "1",
"description": "A frontend developer"
}