Skip to content

Multi user REST API for jokes management and generation

License

Notifications You must be signed in to change notification settings

perewall/jokes-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://travis-ci.com/perewall/jokes-api.svg?branch=master

Jokes API

Multi user REST API for jokes management and generation (via public api)

This application is a test task, written on Python with Flask

Setup

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

Usage

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

Documentation

Usage examples and API description

Build docs with Sphinx:

python manage.py docs -o htmldoc

and open htmldoc/index.html in your favourite browser

About

Multi user REST API for jokes management and generation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published