A full-featured backend API to track, manage, and analyze stock investments with JWT-based authentication.
https://stock-manager-1-80ih.onrender.com
Create a new user account.
- Endpoint:
POST /api/users/register - Request Body:
{
"username": "yourname",
"email": "youremail@example.com",
"password": "yourpassword"
}- Curl Example:
curl -X POST https://stock-manager-1-80ih.onrender.com/api/users/register \
-H "Content-Type: application/json" \
-d '{"username":"john","email":"john@example.com","password":"123456"}'Authenticate user and receive JWT.
- Endpoint:
POST /api/users/login - Request Body:
{
"email": "youremail@example.com",
"password": "yourpassword"
}- Curl Example:
curl -X POST https://stock-manager-1-80ih.onrender.com/api/users/login \
-H "Content-Type: application/json" \
-d '{"email":"john@example.com","password":"123456"}'All routes below require JWT Authentication. Add the header:
-H "Authorization: Bearer <your_token>"
curl -X POST https://stock-manager-1-80ih.onrender.com/api/stocks/add \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{"name": "NABIL", "price": 550, "units": 100}'curl -X PATCH https://stock-manager-1-80ih.onrender.com/api/stocks/update/<stock_id> \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{"price": 600, "units": 150}'curl -X DELETE https://stock-manager-1-80ih.onrender.com/api/stocks/delete/<stock_id> \
-H "Authorization: Bearer <your_token>"curl -X GET https://stock-manager-1-80ih.onrender.com/api/stocks/all \
-H "Authorization: Bearer <your_token>"curl -X POST https://stock-manager-1-80ih.onrender.com/api/stocks/sell \
-H "Authorization: Bearer <your_token>" \
-H "Content-Type: application/json" \
-d '{"stockId": "<stock_id>", "unitsSold": 50, "price": 600}'curl -X GET https://stock-manager-1-80ih.onrender.com/api/stocks/sell-history \
-H "Authorization: Bearer <your_token>"curl -X GET https://stock-manager-1-80ih.onrender.com/api/stocks/sell-summary \
-H "Authorization: Bearer <your_token>"curl -X GET https://stock-manager-1-80ih.onrender.com/api/stocks/summary \
-H "Authorization: Bearer <your_token>"curl -X GET https://stock-manager-1-80ih.onrender.com/api/stocks/export/current-stocks/csv \
-H "Authorization: Bearer <your_token>" --output stocks.csv