Task Ninja is a simple todo application backend built using Go (Golang), Gorilla Mux, and MongoDB.
- Create, read, update, and delete tasks
- Store tasks in a MongoDB database
- RESTful API endpoints for simple task management
Before you begin, ensure you have the following installed:
-
Go (Golang): Make sure you have Go installed on your system. You can download it from the official website: Go Downloads
-
MongoDB: You'll need a running MongoDB server. You can install it locally or use a cloud-based service.
-
Gorilla Mux: We'll use Gorilla Mux for routing. Install it using:
go get -u github.com/gorilla/mux
-
MongoDB Go driver: We'll use the official MongoDB Go driver. Install it using:
go get go.mongodb.org/mongo-driver
-
Clone the repository:
git clone https://github.com/priyanshupatra02/task_ninja_backend.git cd task_ninja_backend
-
Set up your environment variables
.env
:const ( dbHost = "<your-host-url-copied-from-mongoDB" dbName = "<as-set-in-your-mongoDB" collection = "<as-set-in-your-mongoDB>" )
-
Build and run the server:
go build . go run main.go
- GET /api/getAllTasks: Get all tasks
- POST /api/task: Create a new task
- PUT /api/task/{id}: Mark an existing task as completed
- PUT /api/undoTask/{id}: Undo a task
- DELETE /api/deleteTask/{id}: Delete a task
- DELETE /api/deleteAllTasks: Delete all tasks
Use a tool like curl
or Postman to interact with the API endpoints.
Contributions are welcome! Feel free to open issues or submit pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to customize this README according to your project's specifics. Happy coding! ๐