A simple REST API for managing todo items using Go, Fiber, and Redis. This project demonstrates how to create, retrieve, update, and delete todo items stored in Redis through HTTP endpoints.
- Create Todo: Add a new todo item to the Redis store.
- Get All Todos: Retrieve a list of all todo items stored in Redis.
- Get Todo by ID: Fetch a specific todo item using its ID.
- Update Todo: Modify an existing todo item (title and completion status).
- Delete Todo: Remove a todo item from Redis by ID.
- Go (v1.23.3)
- Fiber (v2.52.5) - A fast and lightweight web framework for Go.
- Redis (v9.7.0) - A high-performance in-memory database used for storing todo items.
- UUID - For generating unique identifiers.
- Gofiber - Web framework used to handle HTTP requests and routing.
- Install Go (version 1.23.3 or later).
- Install Redis and ensure it's running locally on port
6379
.
-
Clone the repository:
git clone https://github.com/yourusername/RedisRESTAPI.git cd RedisRESTAPI
-
Install dependencies:
go mod tidy
-
Run the application:
go run main.go
The server will be running on
http://localhost:3000
.
- Description: Creates a new Todo item.
- Request Body:
{ "title": "Your Todo Title" }
- Response:
{ "id": 1, "title": "Your Todo Title", "completed": false }
- Description: Retrieves a list of all Todo items.
- Response:
[ { "id": 1, "title": "Your Todo Title", "completed": false } ]
- Description: Retrieves a specific Todo item by ID.
- Response:
{ "id": 1, "title": "Your Todo Title", "completed": false }
- Description: Updates an existing Todo item by ID.
- Request Body:
{ "title": "Updated Todo Title", "completed": true }
- Response:
{ "id": 1, "title": "Updated Todo Title", "completed": true }
- Description: Deletes a Todo item by ID.
- Response: 200 OK
Feel free to fork this repository and contribute to the development of RedisRESTAPI. Any improvements, bug fixes, and feature additions are welcome.
This project is open-source and available under the MIT License.