Implementation of a simple flask API using MongoDB.
- Install and run MongoDB (ideally 3.6.0)
- Install Python (idealy Python 3)
Or
$ easy_install pip && \
pip install virtualenv && \
virtualenv env && \
. env/bin/activate && \
make deps
$ pip install -r requirements.txt
$ export FLASK_APP=flask_initdb.py
$ export FLASK_API_DB_URL=mongodb://localhost:27017/<yourcollection>>
Note : databaseUrl is optional, if not used the application will connect to mongodb://localhost:27017/flask
$ flask initdb
Note : the database won't be populated if there is already some documents in songs collection
$ flask cleandb
$ python flask_api.py
Finally open in your browser http://127.0.0.1:5000.
$ py.test tests
$ python flask_integration_tests.py
- [Optimisation] : use cache on main controller
- [Optimisation] : limit the number of result after a search or add a pagination ?
- [Database] : parse release date as a Date
- [Tests] : cover all the tests