Multi user REST API for jokes management and generation (via public api)
This application is a test task, written on Python with Flask
Application requires Python>=3.6 and SQL database (SQLite/MySQL/PostgreSQL/etc)
Create virtual environment:
python3 -m venv env
. env/bin/activate
Install requirements:
pip install -r requirements.txt
Run unit tests:
python manage.py test
Configure database connection string via environment variable or .env
:
export JOKES_API_DATABASE_URL=sqlite:////tmp/jokes.db
Create database schema:
python manage.py db upgrade
Create first user:
python manage.py users create <username>
and remeber the user token, you will need it later
python manage.py --help
Run dev server:
python manage.py run -h 127.0.0.1 -p 8000
and try to make request with curl
:
curl -H "Authorization: <token>" localhost:8000/new
where <token>
is token, which you got after user creation
Usage examples and API description
Build docs with Sphinx:
python manage.py docs -o htmldoc
and open htmldoc/index.html
in your favourite browser