Skip to content

Latest commit

 

History

History
169 lines (117 loc) · 6.49 KB

File metadata and controls

169 lines (117 loc) · 6.49 KB

Node.js based Task Manager API With Login System

📓 📝 📧 📚

Task Manager API deployed on Heroku.

For API Access follow Documentation and Switch on to Postman via https://task-manager-notsonoobie.herokuapp.com


Project Status :

COMPLETE 🔥

tested with jest jest

Environments Required :

Check for proper Installation :

$ node -v
$ npm -v
$ git --version

Required Dependencies :

Developer Dependencies :

Environment Variables :

  1. Create config Directory inside task-manager
  2. Create dev.env File inside ../task-manager/config/
  3. Create test.env File inside ../task-manager/config
  4. Define PORT (For Running Applications) , SEND_GRID_API_KEY (API Key for Sending Authenticated Emails) , MONGO_DB_URL (For Connection to MongoDB Database) , JWT_SECRET_KEY (For Verification of JWT Token)

To get details about how to declare Environment Variables visit env-cmd Documentation. I have not provided my own .env configuration file for security concerns, so refer to the documentation.

Clients :

  1. Install Clients :

     $ git clone https://github.com/notsonoobie/task-manager-api.git
    
     $ cd task-manager-api/
    
     $ npm install
    
  2. Scripts :

    • Start Client (Prod Mode) :

      node src/app.js 
      
    • Start Client (Dev Mode) :

      env-cmd ./config/dev.env nodemon src/index.js
      
    • Test (Jest Integration) :

      env-cmd ./config/test.env jest --watch --runInBand
      
  3. Start Client :

    • Start Client (Prod Mode) :

       $ npm run start
      
    • Start Client (Dev Mode) :

      $ npm run dev
      
  4. Testing Client with JEST :

       $ npm test
    

Project Description :

This is a Node.js based Task Manager API supports JWT Authentication and Login System with Email Support. This app uses JWT Tokens for Authentication of User for Modifying Profile (User) / Task Data. The data is stored in MongoDB Database. User Can upload Profile Avatar using multer module support to the API which is then modified by sharp module and then stored in Database as Buffer. The task data can be viewed using endpoint which also offers Filtering , Sorting , & Pagination of the Task Data. For every access/modification request User has to get Authenticated with Valid JWT verified Token. The project is also tested with JEST Framework for Automated Testing of API Endpoints. The entire architecture is based on REST-API which supports :

  • POST REQ - CREATING USER {{url}}/users
  • POST REQ - LOGGING-IN USER {{url}}/users/login
  • POST REQ - CREATING TASK {{url}}/task
  • POST REQ - LOGGING-OUT USER {{url}}/users/logout
  • POST REQ - LOGGING-OUT USER (ALL SESSIONS) {{url}}/users/logoutAll
  • POST REQ - UPLOADING AVATAR(PROFILE) {{url}}/users/me/avatar
  • GET REQ - READING PROFILE {{url}}/users/me
  • GET REQ - READING A TASK {{url}}/task/:taskid
  • GET REQ - READING TASKS :
    • For Reading All Task : {{url}}/tasks
    • For Reading Filtered Task based on Status : {{url}}/tasks?status=true|false
    • For Reading Limited Task : {{url}}/tasks?limit=:NumberToLimit
    • For Reading Task after Skipping few Task : {{url}}/tasks?skip=:NumberToSkip
    • For Reading Sorted in Asc Order based on Property : {{url}}/tasks?sortBy=:prop::asc
    • For Reading Sorted in Desc Order based on Property : {{url}}/tasks?sortBy=:prop::desc
  • GET REQ - VIEWING AVATAR {{url}}/users/:userid/avatar
  • PATCH REQ - UPDATING USER {{url}}/users/me
  • PATCH REQ - UPDATING TASK {{url}}/task/:taskid
  • DELETE REQ - DELETING USER {{url}}/user/me
  • DELETE REQ - DELETING AVATAR {{url}}/users/me/avatar
  • DELETE REQ - DELETING TASK {{url}}/task/:taskid

POSTMAN WORKFLOW AND AUTOMATION

The Post App need to be configured and Scipted for Automation of the workflow for Authentication (Although it is not necessary).

  • Load the Collection from : ../task-manager/Postman Collection/Task App.postman_collection.json into Postman APP.
  • Load Environment Variables for Dev into Postman APP : ../task-manager/Postman Collection/Task Manager API (dev).postman_environment.json
  • Load Environment Variables for Prod into Postman APP : ../task-manager/Postman Collection/Task Manager API (Prod).postman_environment.json

You are good to go... 😬

Project Architecture



Architecture


Testing with Jest Framework



Jest


NOTE :

You can use the code under MIT License but mention of Author ( Rahul Gupta @notsonoobie ) is appreciable.


Contact Me

☎️ +91-89288-85199

📧 swastikmedical74@gmail.com

🌐 http://showcasingmyself.netlify.com

:octocat: notsonoobie


© Rahul Gupta (notsonoobie) -- Thank You! 🤓