changing flask over to use api functionality