The Task-Manager-Api with authentication support for different users. It provides different functionalities like
- Create User
- Create Task
- Login User
- Logout User
- Logout from all sessions
- Fetch Your Profile
- Get Your Tasks
- Update User
- Update Task
- Upload a profile pic or avatar.
- Delete avatar
- Delete User
- Delete Task
- The app is primarily built on NodeJS which is used as the backend . Express is used to create the server.Mongodb is used as the database to store the data of different users and their tasks.
- JWT is used to integrate the authentication service into the app.
- Sendgrid is used to send auto generated emails to the users when they signup or delete their profile.
- Bcrypt is used to hash the passwords provided by the users.
You should have the following tools installed in your system.
- Node
- npm
- Git
- MongoDB Database installed and running on your system.
- Robo-3t or MongoDB Compass installed on your system to see the data in the database.
- Postman (to test the api end-points)
Clone the repo and install the dependencies.
-
git clone https://github.com/akshatb622/task-manager-api.git
-
npm install
-
Create an account on Sendgrid.com to get your api-key to send the auto generated emails.
-
Make a folder in root of the project with the name config. Inside the folder make a file dev.env(which is used to set the local environment variables).
-
Now edit the dev.env file as :
i) PORT=3000
ii) SENDGRID_API_KEY=<Your api key that you got from step 3>
iii) JWT_SECRET=Any text which should be your secret
iv) MONGODB_CONNECTION_STRING=mongodb://127.0.0.1:27017/task-manager-api -
Save the file.
-
Open the file /src/emails/account.js and set the from property of all sgMail.send functions to your email-id registered on Sendgrid.com.
-
Save the File.
Before following the steps below ensure that mongodb is running on your system.
-
To start the express server, run the following :
npm run dev -
Open Postman and start sending requests to http://localhost:3000 and see what you get.