https://github.com/schemar/webulator
A calculator web service
https://github.com/schemar/webulator
Last synced: 2 months ago
JSON representation
A calculator web service
- Host: GitHub
- URL: https://github.com/schemar/webulator
- Owner: schemar
- Created: 2019-06-05T19:47:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T00:41:32.000Z (about 2 years ago)
- Last Synced: 2025-03-06T00:08:00.564Z (2 months ago)
- Language: TypeScript
- Size: 420 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Webulator
Webulator can return responses to mathematical requests.
For example, webulator can return `-527.6060606060606` as the result of the
request `2 * (23/(33))- 23 * (23)`.## Running webulator
Requirements: node and npm.
To run webulator:```bash
git clone https://github.com/schemar/webulator.git
cd webulator
npm ci
npm start
```By default, webulator tries to start on port `80`. You can specify a different
port with the `--port` option. To listen, for example, on port `35000`:```bash
npm start -- --port 35000
```## Accessing webulator
Access webulator under the route `/calculus` with a Base64 encoded query as a
`query` query parameter. Example:```
# base64("2 * (23/(33))- 23 * (23)") => MiAqICgyMy8oMzMpKS0gMjMgKiAoMjMp
curl http://example.com/calculus?query=MiAqICgyMy8oMzMpKS0gMjMgKiAoMjMp# Response: {"error":false,"result":-527.6060606060606}
```The response status code is `200` on success, or `4xx`/`5xx` if there is an error.
The response body is:* in the success case: `{"error":false,"result":}`
* in the error case: `{"error":true,"message":}`## Testing
Run `npm test` to run all tests: linting, unit tests, and integration tests.