Skip to content

dkdeptrai/graph_ql_exercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GraphQL User Service

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.

Features

Queries

  • getUser(id: ID!): User Retrieve user details (username, description) by ID.

Mutations

  • 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.

Setup and Installation

Clone the repository:

Copy code

git clone https://github.com/dkdeptrai/graph_ql_exercise.git
cd graph_ql_exercise

Install dependencies:

npm install

Start the server:

node server.js

Access the GraphQL Playground:

Usage

Example Queries and Mutations

Query: Retrieve User

query {
  getUser(id: "1") {
    username
    description
  }
}

Mutation: Update User Description

mutation ($updateUserDescriptionId: ID!, $description: String!) {
  updateUserDescription(
    id: $updateUserDescriptionId
    description: $description
  ) {
    id
    description
  }
}

Variables:

{
  "id": "1",
  "description": "A frontend developer"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published