Skip to content

πŸ“‹ Task Manager API - A RESTful CRUD application for managing tasks built with Node.js, Express, and MongoDB

Notifications You must be signed in to change notification settings

AlpTalhaYazar/task-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Task Manager API

A RESTful API for managing tasks built with Node.js, Express, and MongoDB, with a clean frontend interface.

Features

  • Create, read, update, and delete tasks
  • Task status tracking
  • Pagination and filtering support
  • Frontend interface for task management
  • Responsive design with modern CSS
  • Error handling and custom response formats
  • Query parameter parsing for advanced filtering

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB
  • Modern web browser

Setup

  1. Clone the repository
  2. Install dependencies:
npm install
  1. Create a .env file in the root directory and add:
MONGO_URI=your_mongodb_connection_string
PORT=3000
  1. Start the server:
npm start

API Endpoints

Tasks

Method Endpoint Description
GET /api/v1/tasks Get all tasks with filtering options
POST /api/v1/tasks Create a new task
GET /api/v1/tasks/:id Get a single task
PATCH /api/v1/tasks/:id Update a task
DELETE /api/v1/tasks/:id Delete a task

Query Parameters

The GET /api/v1/tasks endpoint supports the following query parameters:

  • page: Page number for pagination (default: 1)
  • limit: Number of items per page (default: 10)
  • sort: Sort field (default: "createdAt")
  • fields: Select specific fields
  • numericFilters: Apply numeric filters (>, <, >=, <=)
  • search: Search in specific fields

Response Format

The API returns responses in a consistent format:

{
  "isSuccess": true,
  "data": [],
  "page": 1,
  "limit": 10,
  "total": 0,
  "totalPages": 0,
  "hasNext": false,
  "hasPrevious": false
}

Frontend Interface

The project includes a frontend interface with the following features:

  • Task listing with completion status
  • Add new tasks
  • Edit existing tasks
  • Delete tasks
  • Responsive design
  • Success/Error notifications

Error Handling

The API uses conventional HTTP response codes:

  • 200: Success
  • 201: Created
  • 400: Bad Request
  • 404: Not Found
  • 500: Server Error

Project Structure

β”œβ”€β”€ app.js              # Application entry point
β”œβ”€β”€ controllers/        # Route controllers
β”œβ”€β”€ middleware/         # Custom middleware
β”œβ”€β”€ models/            # Database models
β”œβ”€β”€ public/            # Frontend assets
β”œβ”€β”€ routes/            # API routes
β”œβ”€β”€ utils/             # Utility functions
└── db/                # Database connection

Technologies Used

  • Express.js
  • MongoDB with Mongoose
  • CORS
  • dotenv
  • HTTP Status Codes
  • Frontend: HTML5, CSS3, JavaScript
  • Axios for API calls

About

πŸ“‹ Task Manager API - A RESTful CRUD application for managing tasks built with Node.js, Express, and MongoDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published