Skip to content

Manokha/RESTo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RESTo: a REST API for restaurants

Requirements

This module requires:

  • an installed and configured postgresql server.
  • a python 3.8 installation.

Install:

Using docker compose:

docker-compose build web

Manually:

App

pip3 install .

Database

Apply sql/install.sql to desired user (this will create Restaurants table).

Configure

Copy /etc/peopledoc-test/resto.example.ini to /etc/peopledoc-test/resto.ini

Set postgresql connection informations. You're set !

Launch:

Using docker compose:

App

docker-compose up web

⚠️ On my machine, the first time I run this command, the web docker starts "too fast" and tries to connect to the "db" one that is not yet ready. If the db is already up, it's fine.

TODO: workaround.

Tests

docker-compose run web pytest

Manually:

App:

Help:
$ resto-server --help
usage: resto-server [-h] [-c CONFIGURATION]

resto server

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIGURATION, --configuration CONFIGURATION
                        Configuration file path (default: /etc/peopledoc-test/resto.ini).
Examples:
resto-server
resto-server -c test-resto.ini

Tests:

pytest

Documentation:

Postman documentation

Explorations

Evolutions

  • Improve documentation.
  • Improve logs.
  • Implement a reload function for the configuration file.
  • Install init.d script (through debian package ?).
  • Implement profiling.
  • Use sqlalchemy ?
  • Use a gateway for authentication / rate-limiting etc (Kong ?).
  • Handle web handler cancellation using asyncio.shield (https://docs.aiohttp.org/en/stable/web_advanced.html#web-handler-cancellation).
  • Test python 3.6 compatibility for pypy, then pypy and check performance gains.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published