simple example of using flask to generate an api
This project has a Vagrant-backed platform and standard setup. The Vagrant box is Ubuntu 14.04 and is provided by Hashicorp. Running
vagrant up will stand up the VM and provision it with the dependencies required to run this application. The operator will need to
vagrant ssh into the VM and start the services as described below in the section "How to Use".
This configuration has been tested successfully with Vagrant 1.8.1. Vagrant 1.7.3 will not work with the specified
Alternatively, the following Python modules may be installed by hand directly on your computer to meet the application's requirements for a local (bare metal) run.
pip install Flask
pip install requests
pip install flask-httpauth
pip install passlib
How to Use
From a command line at the root of the project, run
A list of
curl commands to test the REST API is included in
To test the api service using the Front End flask app, open another terminal window and run
This sample uses a simple list of objects as our data store. The principles can be easily transferred to using a backend of your choice.
On the browser go to either
http://localhost:5001 (if running locally) or
http://localhost:8000 (if running in the VM) to view the front end portion.
You can run tests from the command line by running
This demo/example would work great with a simple mongo backend and ORM implementation in the code.
Also, it would be nice to set up a Vagrant script for launching a VM with all the dependencies pre-installed so users could see it working without installing and configuring dependencies themselves.
In preparing this demo, I consulted and pulled from a few tutorials online: