This library provides a simple API to compute litteral expression using infix / prefix notation.
The only requirements to run the library/API is docker.
A Makefile is provided for convenience.
You can build and run the test suite with
# Test the library
make build-test test TEST=library
To serve the API, run
# Build and serve the API
make build-api serve
To test it, run
# Test the API (once it is running)
make test TEST=api
NOTE
Make sure to specify the right IP in config.yaml
# IP of the api container
# You find it by running
# docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' api
host: '172.17.0.2'
port: 80
Once it is running, you can send POST request directly from a terminal
curl -X POST "http://0.0.0.0/calculate_infix" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"expression\":\"( 1 + 1 )\"}"
Or, you can head to API to explore it in more details.