This project is a simple Task Management API built using Node.js, Express.js, and GraphQL. It demonstrates how to perform CRUD (Create, Read, Update, Delete) operations on tasks, using an in-memory data storage solution. The project is designed to help developers understand the basics of GraphQL integration with Node.js.
- Add Tasks: Create new tasks with a title, description, and default status.
- View Tasks: Retrieve all tasks or fetch a specific task by its unique ID.
- Update Tasks: Modify task details, such as title, description, and status.
- Delete Tasks: Remove tasks by their unique ID.
- GraphiQL Interface: Provides a user-friendly interface for testing queries and mutations at
http://localhost:4000/graphql.
- Node.js: Backend runtime environment.
- Express.js: Web framework for building the API.
- GraphQL: API query language for flexible and efficient data retrieval.
-
Clone the Repository:
git clone <repository-url> cd graphql-task-manager
-
Install Dependencies:
npm install
-
Start the Server:
node server.js
-
Access GraphiQL: Open your browser and navigate to
http://localhost:4000/graphqlto test the API.
Here are some example queries and mutations you can run in GraphiQL:
query {
tasks {
id
title
description
status
}
}mutation {
addTask(title: "New Task", description: "This is a new task") {
id
title
description
status
}
}mutation {
updateTask(id: 1, title: "Updated Task", status: "Completed") {
id
title
description
status
}
}mutation {
deleteTask(id: 1) {
id
title
}
}