Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chiomasarah/calculator-app
A calculator app that allows users perform basic arithmetic operations.
https://github.com/chiomasarah/calculator-app
mocha-chai mongodb-atlas node-js react-js react-testing-library unit-testing
Last synced: 4 days ago
JSON representation
A calculator app that allows users perform basic arithmetic operations.
- Host: GitHub
- URL: https://github.com/chiomasarah/calculator-app
- Owner: ChiomaSarah
- Created: 2023-10-14T12:24:26.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-15T13:57:29.000Z (about 1 year ago)
- Last Synced: 2024-05-29T19:18:54.018Z (6 months ago)
- Topics: mocha-chai, mongodb-atlas, node-js, react-js, react-testing-library, unit-testing
- Language: JavaScript
- Homepage:
- Size: 288 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Calculator-App
A simple calculator web application built using Node.js, MongoDB, and React. This calculator allows users to perform basic arithmetic operations and displays the result. Additionally, it can save and retrieve calculation history.
![image](https://github.com/ChiomaSarah/Calculator-App/assets/78868674/38bc74aa-c37b-4b6b-b37e-149ae00f7f2f)
## Table of Contents
- Features
- Prerequisites
- Installation
- Usage
- API Endpoints
- Contributing
- License## Features
- Perform basic arithmetic operations (addition, subtraction, multiplication, and division).
- Display calculation results.
- Save and retrieve calculation history (not implemented in this example).
- Error handling for invalid expressions and API requests.
- Basic styling for a clean user interface.## Prerequisites
Before you begin, ensure you have met the following requirements:
- Node.js is installed on your local machine.
- MongoDB is installed and running (for persisting the history).
- Basic knowledge of Node.js, React, and MongoDB.## Installation
Clone the repository:
```bash
git clone https://github.com/ChiomaSarah/Calculator-App.git
```Navigate to the project directory:
```bash
cd calculator-app
```Install backend dependencies:
```bash
cd backend
npm install
```Install frontend dependencies:
```bash
cd frontend
npm install
```## Usage
Start the server:
```bash
cd backend
npm start
```The server should now be running on http://localhost:9000.
Start the React app:
```bash
cd frontend
npm start
```## API Endpoints
The server provides the following API endpoints:
- POST /calculate: Calculate arithmetic expressions.
Sample Request: { "arithmeticFunction": "2 + 2" }
Sample Response: { "result": 4 }
- GET /history : Retrieve calculation history.
Response: An array of arithmetic operations.
## Contributing
Feel free to contribute to this project. You can fork the repository, make changes, and create a pull request. Please follow best practices and maintain code quality. If you encounter any issues or have ideas for improvements, open an issue on the project's GitHub repository.
## License
This project is licensed under the [MIT License](https://choosealicense.com/licenses/mit/).