cuspaceflight/tawhiri — pull request #94 by rjw57 (2014-11-15 11:21:04+00:00)
Title: api: refactor as separate Flask Blueprint

Increase modularity by moving API into the tawhiri.api.v1 module and
re-expressing it as a Flask blueprint. This lets one specify the
location of the API as a single URL prefix when creating the Flask app.
It also allows single-API only applications as used, for example, in
testapi.py.

This PR makes no change to the logic of api.py. It merely moves the file
and allows central configuration of the URL prefix. See
http://flask.pocoo.org/docs/0.10/blueprints/ for more discussion of the
advantages of using Blueprints when considering application modularity.

The rationale for this modification is that it allows a) experimental or
"v2" APIs to be cleanly added and b) for APIs to share common
code/interfaces within the api module.

It is envisaged that some light re-factoring will lead to a module
within api which can be cleanly mocked to unit-test the web request
logic separately from the actual landing prediction code.