The Financial Tracker API is designed to help users track their financial transactions. With the capability to record, update, retrieve, and delete transactions, this API makes managing personal finance data simple and straightforward.
- Add new transactions with type, name, and amount.
- Edit existing transactions.
- Delete transactions.
- Search transactions by name.
- Filter transactions by type.
- View aggregate data for total cash in, cash out, and balance.
- Secure with basic authentication.
- Frontend: Vanilla JS and Bootstrap 5.
- Backend: ExpressJS with in-memory data storage.
- Clone the repository:
git clone https://github.com/m-istighfar/week-8-m-istighfar.git
- Navigate to the project directory:
cd week-8-m-istighfar
- Install the necessary dependencies:
npm install
- Start the server:
npm start
Your server should start on http://localhost:3000/
. Open this URL in your browser to access the app
- Endpoint:
/api/products
- Method:
GET
- Response: A list of all transactions.
- Endpoint:
/api/products/:id
- Method:
GET
- Parameters:
id
- ID of the transaction.
- Endpoint:
/api/products
- Method:
GET
- Query Parameters:
name
: Name or part of the name of the transaction you're looking for.- Example:
/api/products?name=lunch
- Endpoint:
/api/products
- Method:
GET
- Query Parameters:
type
: The type of transactions you're interested in. It can be either "Kas Masuk" or "Kas Keluar".- Example:
/api/products?type=Kas Masuk
- Endpoint:
/api/products
- Method:
GET
- Query Parameters:
name
: Name or part of the name of the transaction you're looking for.type
: The type of transactions you're interested in.- Example:
/api/products?name=lunch&type=Kas Keluar
- Endpoint:
/api/roducts
- Method:
POST
- Body:
type
: Either "Kas Masuk" or "Kas Keluar".name
: Name/description of the transaction.amount
: Amount of money for the transaction.
- Endpoint:
/api/products/:id
- Method:
PUT
- Parameters:
id
- ID of the transaction.
- Endpoint:
/api/products/:id
- Method:
PATCH
- Parameters:
id
- ID of the transaction. - Body (example): You can include one or more of the following fields to update:
type
: Either "Kas Masuk" or "Kas Keluar".name
: Name/description of the transaction.amount
: Amount of money for the transaction.
- Description: This endpoint allows you to update specific fields of a transaction without affecting other fields. If a field is omitted from the body, it will remain unchanged in the database.
- Endpoint:
/api/products/:id
- Method:
DELETE
- Parameters:
id
- ID of the transaction.
- Endpoint:
/api/products
- Method:
DELETE
- Description: This endpoint deletes all transactions from the database. Use with caution as this operation is irreversible.
To use each request command, please use JSON format. Example:
{
"name": "x",
"amount": "y",
"type": "Kas Masuk" or "Kas Keluar"
}
To access the API, basic authentication is required:
- Username:
revou
- Password:
tim6
Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.
This project is licensed under the MIT License.