Skip to content

this is a repository for the final task for Node.js/Express.js course

Notifications You must be signed in to change notification settings

barakgoren/ExpressJS-Final

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Task Management API

Status GitHub last commit wakatime

πŸ”΄ Live test

You can check this API live on this link : https://calm-dress-bear.cyclic.app/

πŸ‘‹ Introduction

This is a RESTful API for a task management application. It allows users to create, read, update, and delete tasks, and associate them with categories.

πŸš€ Getting Started

Prerequisites

  • Node.js
  • npm
  • MongoDB
  • Nodemon (For dev mode)

Installation

  1. Clone this repository:
git clone https://github.com/barakgoren/ExpressJS-Final.git
  1. Install dependencies:
npm install

βš™οΈ Configuration

  • Create a new ".env" file and insert the fields:

    • JWT_SECRET_KEY - for configuring JWT.
    • USER_DB - The user name to your Atlas if you are using atlas
    • PASS_DB - The password to your Atlas if you are using atlas
    • ADMIN_PASS - This is the password you use to set yourself as an Admin.
  • Modify the MongoDB URL to your Atlas URL or local URL on the app.js file.

    Example for running locally:

    mongoose.connect(`http://localhost:27017`)
      .then(() => {
          console.log('Connected to MongoDB');
      })
      .catch(err => {
          console.log(err);
      })

Running - Choose step 1 or 2:

  1. Start the server with Nodemon on Development mode:
npm run dev
  1. Start the server with Node.js:
npm start

πŸ“š API Documentation

🚹 User Routes

Type Route Prerequisites Description
Badge /users Badge Get all the users
Badge /users/me Badge Get your user details
Badge /users Create new user
Badge /users/login Log in to an existing user - Getting a token back
Badge /users/setAdmin/:id Badge Set a new admin. You can also use it to set yourself an admin by using the "adminPass" attribute on the config.js. Just send an "adminPass" on the body of the PATCH request.

πŸ‘€ Create new User body:

{
    "name": "your name",
    "email": "[email protected]",
    "age": 30,
    "password": "your password"
}

πŸ‘€ Login body:

{
    "email": "[email protected]",
    "password": "your password"
}

πŸ“ Task Routes

Type Route Prerequisites Description
Badge /tasks Badge Get all the tasks
Badge /tasks/myTasks Badge Get the tasks of the current user.
Badge /tasks Badge Create new task.
Badge /tasks/:id Badge Delete an existing task by its ID.
Badge /tasks/:id Badge Updating an existing task by its ID.

πŸ“ Create new Task body:

{
    "title": "Task name",
    "category": "Category ID",
    "dueDate": "yyyy-MM-dd",
    "description": "Task description"
}

🏷️ Category Routes

Type Route Prerequisites Description
Badge /categories Get all the categories
Badge /categories/:id Badge Get the categories of the tasks by its ID
Badge /categories Badge Create a new category
Badge /categories/:id Badge Delete a category
Badge /categories/:id Badge Update a category

🏷️ Create new Category body:

{
    "name": "Category name",
    "description": "Category description"
}

🀝 Contributing

Contributions, issues and feature requests are welcome. Feel free to check issues page if you want to contribute.

About

this is a repository for the final task for Node.js/Express.js course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published