Skip to content

High-level NodeJS task manager application with RESTful APIs to practice CRUD operations, Authentication, Pagination with various types of HTTP Request methods.

License

Notifications You must be signed in to change notification settings

rameshrrl/task-manager

Repository files navigation

Task Manager

High-level NodeJS task manager application with RESTful APIs to practice CRUD operations, Authentication, Pagination with various types of Request methods. This application's function was tested with JEST unit tests and CI/CD implemented with the help of GitHub Actions. This application has all the basic API practices like request query, params, body communications APIs with pagination and authentication. So one can get the required knowledge of working with the APIs easily with this application.

Live application link : Application Link, use this link as a base URL and dive into the Get Started section to learn more.

Note: {{}} With words are for placeholder purposes only. Make sure you're not using any {{}} while communicating with the APIs.

Table of content

Features

☑️ Promise based!
☑️ ES6 and above standard javascript!
☑️ Clean and functional response structure!
☑️ Authenticated with JWT!

Get Started

Response Body

This application uses the common response structure. That ensures organized code structure. So I'm introducing the response structure first here.

Key Return Type Description
status boolean Returns true or false based on success and failures.
message string Returns appropriate success and failure messeges
response Object or null Returns Object in success and null in failure cases.

Authentication

This application uses JWT authentication to ensure every API is authenticated except Register and Login APIs. Also add the Bearer token in all the API headers with the key of authorization.

'Bearer <authenticationToken>'

Create A User

  POST {{baseURL}}/user/register
  {
    "user" : {
        "firstName" : "{{$randomFirstName}}",
        "lastName" : "{{$randomLastName}}",
        "phone": {
            "code": "{{$randomCountryCode}}",
            "number": "{{$randomPhoneNumber}}"
        },
        "email" : "{{$randomEmail}}",
        "password": "{{$randomPassword}}"
    }
  }

Get A User

  GET {{baseURL}}/user

To get specific user details no need to pass any parameters. The application will fetch the authenticated user data automatically when you access it with the authenticated token. Learn more about it here Authentication.

Update A User

  PUT {{baseURL}}/user/update

Update operations also follow the same request structure of creating Create A User.

Note: if you tried to update the Email, the application can detect that new email and returns you the updated authentication token.

Delete A User

  DELETE {{baseURL}}/user/remove

The application will delete the authenticated user data automatically when you access it with the authenticated token. Learn more about it here Authentication.

Login A User

  POST {{baseURL}}/user/login
  {
    "email" : "{{$randomEmail}}",
    "password": "{{$randomPassword}}"
  }

Logout A User

  GET {{baseURL}}/user/logout

The application will log you out automatically when you access it with the authenticated token.

Create A Task

  POST {{baseURL}}/task/create
  {
    "task": {
      "title": "{{$randomJobTitle}}",
      "description": "{{$randomPhrase}}"
    }
  }

Get A Task

Get Single Task

  GET {{baseURL}}/task/{{taskId}}

Get Multiple Tasks

  GET {{base_url}}/task?skip={{number}}&limit={{number}}

The id is optional. When you pass the id application will return you a single task Object that matches the given task id. Otherwise, it will return an Array of tasks associated with the authenticated user.

When you fetch Array of tasks you can fetch using skip and limit properties. By default, the application will fetch the first 10 tasks as a result. Hence the default skip value is 0 and limit is 10.

Update A Task

  PUT {{baseURL}}/task/update
  {
    "task": {
            "_id": "{{taskID}}",
            "title": "{{$randomTitle}}",
            "description": "{{$randomDescription}}",
        }
  }

Delete A Task

  DELETE {{baseURL}}/task/remove

This application can support multiple delete and single delete as well. Check below request methods to learn more.

Delete Single Task

  {
    "ids": "{{taskID}}"
  }

Delete Multiple Tasks

  {
    "ids": ["taskID1", "taskID2"]
  }

License

This project is licensed under the MIT License

Contribute

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

High-level NodeJS task manager application with RESTful APIs to practice CRUD operations, Authentication, Pagination with various types of HTTP Request methods.

Topics

Resources

License

Stars

Watchers

Forks