Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Connexion framework #10

Closed
osma opened this issue Oct 3, 2017 · 1 comment
Closed

Switch to Connexion framework #10

osma opened this issue Oct 3, 2017 · 1 comment
Assignees
Milestone

Comments

@osma
Copy link
Member

osma commented Oct 3, 2017

Use Connexion for REST API implementation, using the Swagger API spec to define the functionality

@osma osma added this to the v0.02 milestone Oct 3, 2017
@tvirolai tvirolai self-assigned this Nov 1, 2017
@tvirolai
Copy link
Contributor

tvirolai commented Nov 1, 2017

Note to self: here's how the Flask -> Connexion switch works without breaking existing functionality (ie. command-line interface implemented with Click).

First, create the Connexion app:
annif = connexion.App(__name__)

The Connexion app wraps a normal Flask app, which is here annif.app.

Then define the functions and map them to command-line commands like this:

@annif.app.cli.command('show-project')
@click.argument('projectid')
def show_project(projectid):
    asdflkjsdf

Lastly, add the Swagger API:

annif.add_api('api.yaml')

I'll try to get this implemented right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants