Complete rework to serve app and api using flask