Currency Portfolio is a web application that allows users to manage their cryptocurrency portfolio. Users can track their holdings, view current market prices, and analyze their portfolio performance.
- User registration and authentication
- Add, edit, and delete cryptocurrencies from the portfolio
- View real-time market prices of cryptocurrencies
- Calculate the total portfolio value
- Track portfolio performance over time
- User-friendly and responsive interface
Before running the app, ensure that you have the following dependencies installed on your machine:
- Node.js
- npm (Node package manager)
- MongoDB
- Clone the repository:
git clone https://github.com/Zo-ambinintsoa/currency-portfolio-backend.git
- Navigate to the project directory:
cd currency-portfolio-backend
- Install the package:
npm install
To start the development server, run the following command:
npm start
This will start the development server. You can access it at http://localhost:4000.
The app provides a an endpoint for you to consumme using postman or other testing app.
Feel free to customize the app by modifying the code in the src directory.
This API documentation provides details about the available routes and their functionalities in the Currency Portfolio application.
The base URL for all the routes is:
- URL:
/api/login
- Method:
POST
- Description: Authenticates a user and generates an authentication token.
- Request Body:
email
: User's email (string)password
: User's password (string)
- URL:
/api/signup
- Method:
POST
- Description: Registers a new user.
- Request Body:
email
: User's email (string)password
: User's password (string)
- URL:
/api/changePassword
- Method:
POST
- Description: Changes the password of an authenticated user.
- Authentication Required: Yes
- Request Body:
oldPassword
: User's current password (string)newPassword
: User's new password (string)
- URL:
/api/logout
- Method:
GET
- Description: Retrieves the user profile.
- Authentication Required: Yes
- URL:
/api/logout
- Method:
GET
- Description: Updates the user profile.
- Authentication Required: Yes
- URL:
/api/logout
- Method:
GET
- Description: Logs out the user.
- Authentication Required: Yes
- URL:
/currencies
- Method:
POST
- Description: Creates a new currency.
- Authentication Required: Yes
- Admin Access Required: Yes
- Request Body:
ticker
: Currency's ticker symbol (string)name
: Currency's name (string)APIUrl
: Currency's API URL (string)
- URL:
/currencies
- Method:
GET
- Description: Retrieves all currencies.
- Authentication Required: Yes
- URL:
/currencies/:id
- Method:
GET
- Description: Retrieves a specific currency by its ID.
- Authentication Required: Yes
- URL:
/currencies/:id
- Method:
PUT
- Description: Updates a specific currency by its ID.
- Authentication Required: Yes
- Admin Access Required: Yes
- Request Body:
ticker
: Currency's ticker symbol (string)name
: Currency's name (string)APIUrl
: Currency's API URL (string)
- URL:
/currencies/:id
- Method:
DELETE
- Description: Deletes a specific currency by its ID.
- Authentication Required: Yes
- Admin Access Required: Yes
- The authentication routes (
/api/login
,/api/signup
,/api/changePassword
,/api/logout
) require a valid user account and generate an authentication token. - The routes that require authentication (
/api/logout
,/api/changePassword
,/api/logout
,/currencies
,/currencies/:id
) require the authentication token to be included in the request headers. - The routes that require admin access (
/currencies
,/currencies/:id
) also require the user to have theisAdmin
flag set totrue
in their profile.
- Error responses will follow the standard HTTP error status codes and will include a JSON response body with an
error
property indicating the specific error message.
Contributions are welcome! If you have any suggestions, bug fixes, or new features to propose, please follow the steps below:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your modifications.
- Commit your changes and push to your forked repository.
- Submit a pull request explaining your changes.
Ambinintsoa Mananjara Herizo | Full Stack Developer |