Welcome to the The Vault Payment Bank Account Management API! This project was created as part of an assessment task. The API provides a simple way to create and manage bank accounts. It's built using Node.js and Express.
To run this application on your local machine, follow the steps below.
- Node.js installed on your system.
- Git installed on your system (required for cloning the repository and version control). Note that Git often comes pre-installed for macOS and Linux users.
Clone the repository to your local machine (or download and unzip the ZIP file):
git clone https://github.com/hi-heavens/theVaultPB.git
cd theVaultPB
Install the required dependencies using npm:
npm install
npm start
The API will be available at http://localhost:3000.
Endpoint: POST api/v1/create-account
This endpoint allows users to create a new bank account. Users should send a JSON payload containing the following account details:
- Account holder name
- Account holder DOB (Date of Birth) in the format:
YYYY-MM-DD
- Account type (Savings, Checking, etc.)
- Initial balance
Request Body:
{
"holderName": "John Doe",
"dob": "1990-01-15",
"accountType": "Savings",
"initialBalance": 1000
}
Response: A JSON object with the generated account number and account details.
The endpoint will return a unique 10-digit account number along with the holder's name, account type, and initial balance.
{
"status": "Account created successfully",
"data": {
"accountNumber": 4387510694,
"holderName": "John Doe",
"accountType": "Savings",
"balance": 0
}
}
Endpoint: GET api/v1/account/:accountNumber
This endpoint allows users to fetch the details of a bank account using its account number. Users should provide the account number as a parameter in the URL. The endpoint will respond with the account details if found.
Response: A JSON object with the account details associated with the provided account number.
{
"status": "Successful",
"data": {
"accountNumber": 4387510694,
"holderName": "John Doe",
"accountType": "Savings",
"balance": 0
}
}
Endpoint: GET /accounts
This endpoint returns a list of all bank accounts created so far. The response will include an array containing all account details.
Response: An array of JSON objects, each containing account details.
You can explore and interact with the API using Swagger documentation. To access the documentation, start the application and visit the following URL in a web browser:
http://localhost:3000/swagger
Or via the deployed baseURL. Swagger doc
- Kehinde Adedokun
- Contributions are welcome! If you find any issues or want to add improvements, feel free to fork the repository and create a pull request.
The application has been deployed and is accessible at baseURL. When testing the deployed version, don't forget to add api/v1
to the baseURL for accessing the API endpoints.