Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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/).