A simple task-app-api created in nodejs and hosted in heroku.The api can be tested using postman.
Check this app live preview on heroku.
Technologies I used to develop this App.
Technologies | Purpose |
---|---|
Node.js | App BackEnd. |
MongoDB | Local DataBase set. |
MongoDB Atlas | Multicloud DataBase remote set, to link with Heroku deployment. |
Heroku | Deploy App. |
Express | Create Web Server. |
Mongoose | Execute DB Operations. |
SendInBlue | For sending emails to user (only sends when creating an user or deleting an user). |
BCryptJS | For hashing and authenticating user password. |
JSONWebToken | For generating user session authentication token. |
Validator | For validating user emails. |
Multer | Upload files via API Endpoints. In this case, user avatar icon image. |
Sharp | Convert large images to smaller formats. |
Env-cmd | Deal with environment variables. |
Nodemon | Restart local server, for local development only. |
BackEnd only
This app is built in Node.js and uses MongoDB for local development, make sure you have both installed and set before you begin this process. I suggest you also download MongoDB Compass to get a UI view from your local database.
To install dependencies to run this code locally, follow these steps:
-
Clone
backend
branch from this repo:git clone <repo-url> cd task-app
-
Create an environment file
env.env
intask-app
root folder, with the following variables:PORT=3000 SEND_EMAIL_API_KEY="" JWT_SECRET='' MONGODB_URL_DB="mongodb://127.0.0.1:27017/task-manager-api"
Port
is3000
by default;- Get SendinblueAPI key;
- Set up your own
JWT_SECRET
, it will be used for hashing and comparing hashed passwords. E.g.:'fullstack'
; - Mongo db url is
mongodb://localhost:27017/task-manager-api
,27017
is MongoDB standard port for local DB set, followed by/task-manager-api
which is the DB name, you can alter if you want to.
-
Use npm package to install dependencies:
npm install # or, npm i
To run the app locally, follow these steps:
-
After you define your Mongo DB path and Mongo DB databases folder, run this command to start your DB:
sudo /path/to/mongodb/folder/bin/mongod --dbpath=/path/to/mongodb/database/folder
-
Run one of the following commands to execute the code:
-
Standard run:
npm run start
-
Run with
nodemon
(recommended):npm run dev
-
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.