A RESTful contact API implementation with using Flask SQLAlchemy, PyTest, Marshmallow and Celery.
This repository contains the example code for a contact API project, using SQLAlchemy, PyTest, Celery with Flask.
redis-server
running on background.FLASK_ENV
environment variable as development
. (export FLASK_ENV=development
)celery worker -A celery_worker.celery --loglevel=info
.celery -A celery_worker:celery beat --loglevel=INFO
.flask run
.http://localhost:5000/api/contacts/
and enjoy!You can run the tests with
pytest tests
command.
curl -X POST \
http://localhost:5000/api/contacts/ \
-H 'Content-Type: application/json' \
-d '{
"username": "admin",
"first_name": "Armin",
"last_name": "Ronacher",
"emails": [
{"email": "[email protected]"}
]
}'
curl -X PATCH \
http://localhost:5000/api/contacts/admin/ \
-H 'Content-Type: application/json' \
-d '{
"emails": [
{"email": "[email protected]"}
]
}'
curl -X GET http://localhost:5000/api/contacts/admin/