Adapted from miguelgrinberg's training course
- HTTP Basic Authentication
- Token Authentication
- Pagination
- HTTP Caching
- Request Rate Limit
- Versioning
- Unit Testing
- Customers (/customers/ GET, POST, PUT)
- Orders (/orders/ GET, POST, PUT, DELETE)
- Items (/items/ GET, POST, PUT, DELETE)
- Products (/products/ GET, POST, PUT, DELETE)
$ git clone https://github.com/hungtrv/api_sample.git
$ virtualenv venv
$ source venv/bin/activate
(venv) $ pip install -r requirements.txt
(venv) $ python manage.py init_db
(venv) $ python manage.py create_user admin:123456
(venv) $ export FLASK_APP=run.py
(venv) $ export FLASK_DEBUG=1
(venv) $ flask run
(venv) $ http --auth admin:123456 GET http://localhost:5000/get-auth-token
(venv) $ http --auth <token>: GET http://localhost:5000/v1/customers/
(venv) $ http --auth <token>: POST http://localhost:5000/v1/customers/ name="Vu Nguyen"
(venv) $ http --auth <token>: PUT http://localhost:5000/v1/customers/1 name="Victor Nguyen"
(venv) $ python tests/tests.py