HadithAPI leverages a serverless architecture.
├── Makefile
├── README.md
├── api.raml
├── hadith_api
│ ├── __init__.py
│ ├── app.py
│ ├── chalicelib
│ │ ├── __init__.py
│ │ ├── collections.py
│ │ ├── db.py
│ │ ├── models.py
│ │ ├── rds_config.py
│ │ ├── responder.py
│ │ └── singleton.py
│ └── requirements.txt
├── requirements.txt
└── test
├── requirements.txt
└── unit
The HadithAPI uses Chalice to manage the Lambda code. Here, all of the Chalice commands are abstracted with make in order to simplify. It also uses virtualenv to contain all of the installations. Get started with develop by doing the following:
git clone REPO
cd REPO
pip install -r requirements.txt
make develop
source .env/bin/activate
When finished, remember to deactivate the virtualenv.
Assuming you've completed the setup, simply run:
make runBUT WAIT! Before you can use the API locally, you need to seed the database. The DB is not public, so you'll need to contact a collaborator for access. MySQL server needs to be running locally in order for this step to work.
To get started run:
mysql -u root -p < setup.sqlWhen prompted for the password, just hit enter.
This completes the basic setup - and you should be able to start the application on localhost:8000.
make run
run an AWS APIGateway-esque instance of the application. This starts a server on port 8000 that's responsive to queries (would recommend using curl).
make lint
Run Flake8 on the code under hadith_api/
make test
Run pytest unit tests and print coverage. It should Ideally be expanded to include integration tests
Retrieves list of all hadith
Retrieves list of all hadith by number
Retrieves list of all books
Retrieves book by id
Retrieves list of all collections
Retrieves a specific collection
Retrieves list of books in a specific collection
Retrieves book within specific collection
Retrieves ahadith for specific book and collection
Retrieves specific hadith for specific book and collection
- Enforce RAML spec
- Bootstrap test run to local mysql instance
- Implement staging (dev/beta, prod)
- Travisci integration
- Test deployment
- Simplify AWS credential setup
- Add diagram
- Actually write the README
- Add docstrings and comments to code
- Add caching to DAO layer
- Add integration tests