Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pushpabrol/mock-acounts-bank-api
https://github.com/pushpabrol/mock-acounts-bank-api
Last synced: about 10 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/pushpabrol/mock-acounts-bank-api
- Owner: pushpabrol
- Created: 2024-01-23T04:55:01.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-01-23T05:07:53.000Z (10 months ago)
- Last Synced: 2024-01-23T06:24:36.227Z (10 months ago)
- Language: JavaScript
- Homepage: https://mock-acounts-bank-api.vercel.app
- Size: 6.56 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mock Bank API
## Overview
This Mock Bank API simulates basic banking operations such as transferring funds between accounts and retrieving account information. It is protected by Auth0, ensuring that only authenticated users can access these functionalities.## Features
- **Transfer Funds**: Allows authenticated users to transfer funds between accounts.
- **Get User Accounts**: Retrieves the account details of an authenticated user.## Prerequisites
- Node.js
- npm (Node Package Manager)
- Auth0 account for JWT authentication## Installation
1. **Clone the Repository**
```sh
git clone https://github.com/your-repository/mock-bank-api.git
cd mock-bank-api
```2. **Install Dependencies**
```sh
npm install
```3. **Set Up Environment Variables**
Create a `.env` file in the project root and add the following variables:
```
AUTH0_DOMAIN=your-auth0-domain
AUTH0_AUDIENCE=your-api-audience
```4. **Run the Server**
```sh
node app.js
```## API Endpoints
### Transfer Funds
- **URL**: `/transfer`
- **Method**: `POST`
- **Auth Required**: Yes
- **Data Constraints**:
```json
{
"from": "[valid account number]",
"to": "[valid account number]",
"amount": "[positive number]"
}
```
- **Success Response**:
- **Code**: `200 OK`
- **Content**: `{ message: "Transfer successful", balance: [new balance] }`### Get User Accounts
- **URL**: `/getUserAccounts`
- **Method**: `GET`
- **Auth Required**: Yes
- **URL Params**:
- **Success Response**:
- **Code**: `200 OK`
- **Content**: `[Array of Account Objects]`## Authentication
This API uses JWT tokens for authentication. Tokens should be obtained from Auth0 and included in the `Authorization` header as a Bearer token.## License
This project is licensed under the MIT License - see the LICENSE.md file for details.