Moving logic out of flask server
The logic for taking user input and turning it into a JSON object is mingled in with the flask routing. This commit starts the process of separating those two functions.