Git Product home page Git Product logo

todoapi's Introduction

ToDoAPI

The ToDoAPI is a RESTful API built with Express.js and MongoDB, providing secure authentication, role-based access control, and robust task management capabilities. It allows users to create, update, and delete to-do lists and individual tasks, with role-specific functionalities for admins and superadmins.

Table of Contents

  1. Introduction
  2. Features
  3. Getting Started
  4. Usage
  5. Routes
  6. Error Handling
  7. Testing
  8. Documentation
  9. Contributing
  10. License

Introduction

The ToDoAPI is designed to facilitate task management for users with different roles. It includes user authentication, role-based access control (RBAC), and CRUD operations for both to-do lists and individual tasks.

Features

  • User registration and login with JWT authentication
  • Role-based access control (User, Admin, SuperAdmin)
  • CRUD operations for user profiles
  • Create, update, and delete to-do lists
  • Manage individual tasks within a list
  • Admin and SuperAdmin functionalities

Getting Started

Prerequisites

Before running the ToDoAPI, ensure you have the following installed:

  • Node.js
  • MongoDB

Installation

  1. Clone the repository:
git clone https://github.com/m-ehab2/ToDoAPI.git
  1. Navigate to the project directory:
cd ToDoAPI
  1. Install dependencies:
npm install

Usage

Authentication

  • Use the /register and /login routes for user registration and login.
  • Include the JWT token received upon login in the Authorization header for authenticated routes.

User Profiles

  • Access and update user profiles using the /profile route.

To-Do Lists

  • Create, update, and delete to-do lists using the /list route.
  • Manage individual tasks within a list using nested routes under /list/:listId/todos.

Admin and SuperAdmin

  • Access admin functionalities using the /Dashboard route (requires Admin or SuperAdmin role).
  • SuperAdmins can perform additional tasks through the /SuperBoard route.

Routes

  • Authentication Routes:

    • /register (POST): User registration.
    • /login (POST): User login.
  • User Routes:

    • /profile (GET, PUT): Access and update user profiles.
  • To-Do List Routes:

    • /list (POST): Create a new to-do list.
    • /list/:listId (GET, PUT, DELETE): Access and manage individual to-do lists.
  • To-Do Routes (Within a List):

    • /list/:listId/todos (GET): Get all to-dos in a list.
    • /list/:listId/todos/:todoId (GET, PUT, DELETE): Access and manage individual to-dos within a list.
  • Admin and SuperAdmin Routes:

    • /Dashboard (GET): Access admin functionalities (requires Admin or SuperAdmin role).
    • /SuperBoard (GET): Access SuperAdmin functionalities.

Error Handling

The API includes comprehensive error handling for various scenarios. Common HTTP error codes are used, along with detailed error messages in the response.

Testing

The project includes unit tests for critical functions and integration tests for API routes. Ensure to run tests to verify the correctness of the implementation.

Documentation

For detailed API documentation, refer to the provided code comments, API routes, and the Postman collection.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

todoapi's People

Contributors

m-ehab2 avatar

Stargazers

 avatar Mohamed Alkayal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.