The Task Manager API is a simple yet powerful API built using Go and Gin. It provides endpoints to manage tasks with in-memory storage. This project is designed to help you learn Go language and understand the fundamentals of building APIs.
- Get a list of all tasks.
- Get the details of a specific task.
- Update a specific task.
- Delete a specific task.
- Create a new task.
To run the Task Manager API locally, follow these steps:
- Clone the repository:
git clone https://github.com/zaahidali/Learn-go-language.git
- Navigate to the
task_manager_api
directory. - Install the required dependencies:
go get github.com/gin-gonic/gin
. - Run the API server:
go run task_manager_api.go
. - The API server will start running at
http://localhost:8080
.
-
GET /tasks
- Get a list of all tasks.
-
GET /tasks/:id
- Get the details of a specific task.
-
PUT /tasks/:id
- Update a specific task.
- Request Body: JSON object with the updated task details.
-
DELETE /tasks/:id
- Delete a specific task.
-
POST /tasks
- Create a new task.
- Request Body: JSON object with the task's title, description, due date, and status.
- Make sure you have Go installed on your system.
- Clone the repository and navigate to the
task_manager_api
directory. - Start the API server by running
go run task_manager_api.go
. - Use a tool like Postman or any other API testing tool to send requests to the API endpoints.
- Send a GET request to
http://localhost:8080/tasks
to retrieve all tasks.
- Send a GET request to
http://localhost:8080/tasks/:id
to retrieve details of a specific task.
- Send a PUT request to
http://localhost:8080/tasks/:id
with a JSON body containing the updated task details.
- Send a DELETE request to
http://localhost:8080/tasks/:id
to delete a specific task.
- Send a POST request to
http://localhost:8080/tasks
with a JSON body containing the task's details to create a new task.
Contributions to the Task Manager API are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request on the GitHub repository.
This project is licensed under the MIT License.
Feel free to explore and learn with the Task Manager API. Happy coding!