Write a JSON API (over HTTP 1.1) service, which receives a basic mathematical expression and returns its result. If the expression is wrong, return an error. The expression can contain parenthesis, factorial and absolute value calculations.
A complicated example:
{
"expression": "5! + abs(6-7*7) / ((9+1)*7)"
}
Which returns
{
"result": "..."
}
Write a web service which shows a form for the expression above, and call the JSON API from this service. Present the result or the error.
Write a simple python script that I can call from the command line. The argument is the expression, and the result printed to the standard output. The error also goes there, not the standard error.
I'm looking for usable solution which is tested and follows the clean code principles.
- please upload your code to github as you progress - I prefer small commits, not a large at the end
- send me the link so that I can read your code
- you can choose any java web framework, just document how to build and start your project
- write tests, consider the testing pyramid
- do not use 3pp besides the java web framework, DI framework and testing frameworks. In other words, implement the business logic on your own
- connect your build to travis-ci
- the web service should look nice, but do not over do it. I'm looking for something usable, not fancy
- the error handling is up to you, do not over do it
- come back occasionally and check if any of the requirements has changed