Skip to content

pshongwe/calculator_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Calculator API

This Calculator API is built using Rust with the Actix-web framework. It supports basic arithmetic operations: addition, subtraction, multiplication, and division.

Prerequisites

To run this project, you will need Rust installed on your machine. You can install Rust from rust-lang.org.

Installation

Getting Started

  1. Clone the repository: Clone the project to your local machine. Replace pshongwe with your actual GitHub username if you have forked or created a repository for this project.
    git clone https://github.com/pshongwe/calculator_api.git
    cd calculator_api
    
  2. Build and run

cargo run
  1. Usage

The API provides four endpoints for basic arithmetic operations: addition, subtraction, multiplication, and division. The operations are performed using query parameters a and b.

Addition

  • Endpoint: /add
  • Method: GET
  • Query Parameters:
    • a: First operand (float)
    • b: Second operand (float)

Example:

curl "http://127.0.0.1:8080/add?a=10&b=5"

Result:

15

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Actix Web: A powerful, pragmatic, and extremely fast web framework for Rust.
  • Serde: A framework for serializing and deserializing Rust data structures efficiently.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages