pymacaron-helloworld
A simple REST api server illustrating how to use pymacaron
See pymacaron for more information.
Requirements
- python >= 3.8
Start the server and run tests
Once you have checked out 'pymacaron-helloworld', install dependencies with
pip install -r requirements.txt
You will also need to install redis to correctly run the celery workers:
- For debian distributions:
sudo apt-get install redis
- For arch distributions:
sudo pacman -S redis
and run the redis server in the background with:
redis-server &
Start the server with:
python server.py --port 8080
To executing api tests, type in a second terminal window:
pymtest
All pymacaron microservices implement the default routes '/ping', '/version' and '/auth/version', defined here.
Asynchronous task
The endpoint '/async' calls a task asynchronously via celery. To see it in action, do in one terminal:
python server.py --port 8080
In an other terminal:
curl http://127.0.0.1:8080/async
Authentication
The endpoint '/async' calls a task asynchronously via celery. To see it in action, do in one terminal:
python server.py --port 8080
In an other terminal:
curl http://127.0.0.1:8080/async