Code Monkey home page Code Monkey logo

xmath-api's Introduction

⚠️ xMath API is deprecated. Now it is part of Shadify project.

Website GitHub repo size GitHub contributions welcome

🚀 xMath-api

A free API for generating random mathematical expressions.

❔ How to use it?

The API provides you with the ability to get a random expression with mathematical operations such as addition, subtraction, multiplication or division. You get an object containing two numbers, an operation sign, and the result of an expression.

You can choose the operation you need or get a random operation.

🎲 Random expression

https://x-math.herokuapp.com/api/random

➕ Only addition

https://x-math.herokuapp.com/api/add

➖ Only subtraction

https://x-math.herokuapp.com/api/sub

✖️ Only multiplication

https://x-math.herokuapp.com/api/mul

➗ Only division

https://x-math.herokuapp.com/api/div

🔧 Parameters

By default, the range of numbers from 1 to 99 is set for all expressions. But you can adjust the range (for any operation) yourself using the parameters.

Range of generated numbers

The max and min parameters change the possible range for each number in the expression.

?max=999&min=100

The maxFirst and minFirst parameters change the possible range only for the first number (the second number uses the default value).

?maxFirst=256&minFirst=128

The maxSecond and minSecond parameters change the possible range only for the second number (does not affect division, because there the second number is randomly selected from the list of divisors of the first number).

?maxSecond=256&minSecond=128

Negative result

To get expressions that result in negative numbers, you can change the range of values using the parameters described above by adding negative numbers there.

But this will not work for the subtraction operation, because by default there the first number is always greater than the second. To fix this, you can use the parameter negative in the value 1.

https://x-math.herokuapp.com/api/sub?negative=1

❕ Examples

https://x-math.herokuapp.com/api/random?max=999&negative=1
https://x-math.herokuapp.com/api/mul?maxFirst=999&maxSecond=20
https://x-math.herokuapp.com/api/add?max=500&minFirst=100

Available Scripts for Developers

In the project directory, you can:

  • Run the server with Nodemon for development
npm run dev

The page will reload if you make edits.
You will also see any lint errors in the console.
Open http://localhost:5000 to view it in the browser.

  • Launch tests
npm run test
  • Create a production build
npm run build
  • Runs the server of production build
npm start

Open http://localhost:5000 to view it in the browser.

xmath-api's People

Contributors

cheatsnake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.