NodeJS REST API server

REST API server with mongoDb database

I had a base application template with user authorization system. I add those features:
- Sign up system, you can create a new user which will be saved in database.
- Animal database, you can add, delete, update and get animals from database.
- Animal API requires token. The token is sent in the headers of each response to the logged user.
- Created accounts are deactivated. After account creating the system sends activation link to registered email address.
- Deactivated users can log in, but they do not have access to the user and animal API.

Animals endpoints:
GET /animals/reset – remove all animals from database, add 2 default animal
GET /animals – return all animals from database, json
GET /animals/:animal_id – return animal with given id, json
POST /animals – add new animal, return json with added animal
DELETE /animals/:animal_id – remove animal with given id, return json with removed animal

There is a Project1.postman_collection.json file in the project folder. You can import it to Postman and test the API.

Get users: As you can see the request has a 'Cookie' header with session key of logged in user
The response has an authorization header with token needed to access animals API
Received token has attached to request authorization header in order to get access to animals API
An email with an activation link:

This time i used a created base app. Also i used ChatGPT and Copilot to write this project. I understand every line of project code. You can download and see the code.

How to run the server: Download the repository to linux system, open the terminal and move to project folder, run "npm install" to install all modules, run "node bin/start".