Skip to content

Latest commit

 

History

History
137 lines (98 loc) · 4.03 KB

README.md

File metadata and controls

137 lines (98 loc) · 4.03 KB

Mutual Funds Manager

This is a backend-based Mutual Fund manager which allows users to add and view mutual funds of their choice written in Go.

Note: If you are a contributer, please read CONTRIBUTING.md

Prerequisites

Setting Up MongoDB

For Windows

  • If MongoDB is installed, find the directory where it is installed. The default installation path for MongoDB on Windows is typically: C:\Program Files\MongoDB\Server\<version>\bin. Replace with the version number you installed (e.g., 5.0).

  • Make sure the MongoDB Server is runnning. To check, go to Start and type Services. Look for the MongoDB server and make sure its running. If not, right click and select Start.

  • For setting up MongoDB Compass, after connecting to localhost:27017, create a new Database mutual_funds with Collection name as funds.

MongoDB tutorial

Setting up Postman

Postman is a tool for testing and interacting with APIs. To set up Postman for interacting with the APIs, create a new Collection named "mutual fund manager" and add Requests within it. Right-click on the collection to add a request, then choose the HTTP request method (GET, POST, PUT, DELETE) and paste the corresponding URL for the desired API endpoint. The methods and URLs for this project are provided below.

Download Postman Video demo

API Endpoints:

Lists All Mutual Funds GET

URL: http://localhost:8080/getAllFunds Description: Lists all the mutual funds available in the database

Create new mutual fund POST

URL: http://localhost:8080/addFund/ Description: Allows creation of a new mutual fund data

Get User Information GET

URL: http://localhost:8080/user/:userID Description: Retrieves user information by user ID

Add New User POST

URL: http://localhost:8080/addUser Description: Creates a new user account

Delete a Mutual Fund DELETE

URL: http://localhost:8080/deleteFund/:id Description: Deletes a specific mutual fund from the database by its id

Update a Mutual Fund PUT

URL: http://localhost:8080/fund/:fundID Description: Updates a specific mutual fund's data in the database using its ID

Update User Information PUT

URL: http://localhost:8080/user/:userID Description: Updates a specific user's details in the database using their user ID

Getting Started

Run the application using go run ..

Example Input Data on Postman

Input data can be entered by selecting Body tab, then choosing raw and JSON format, and pasting the data accordingly. Ensure to follow the provided example for input data structure.

For adding a new mutual fund:

{
    "name": "Motilal Oswal ",
    "category": "Equity",
    "cagr": [
        {
            "1_year": 10.5,
            "3_year": 8.7,
            "5_year": 9.2
        }
    ],
    "rating": 5
}

For adding a new user:

{
  "username": "johndoe",
  "email": "[email protected]",
  "password": "securepassword",
  "first_name": "John",
  "last_name": "Doe",
  "date_of_birth": "1990-01-01T00:00:00Z",
  "phone_number": "+1234567890"
}

For updating an existing mutual fund:

{
    "fund_id": 1,
    "name": "Updated Motilal Oswal Fund",
    "category": "Equity",
    "cagr": [
        {
            "1_year": 11.5,
            "3_year": 9.7,
            "5_year": 10.2
        }
    ],
    "rating": 4
}

For updating an existing user:

{
  "user_id": "20230501123456",
  "username": "johndoe_updated",
  "email": "[email protected]",
  "first_name": "John",
  "last_name": "Doe",
  "date_of_birth": "1990-01-01T00:00:00Z",
  "phone_number": "+1987654321"
}