A sample easer REST API endpoint implementation in Python
You will need the following tools installed on your machine:
- bash
- git
- Python 3.9
- sed
- Task
- clone this repo:
git clone git@github.com:tombenke/person-service-python.git
- Step into the newly cloned folder:
cd person-service-python
- Create a Python virtual environment in the local folder:
task venv-create
- Activate the newly created virtual environment:
. venv/bin/activate
- Install the dependencies:
task install-dev-editable
- Run tests and docs generation:
task
- Build the package, and try to run it:
task build
dist/cli --help
Start the REST API gateway with the person-rest-api definition (docker-compose.test.yml):
task dc-up
Start the container with service implementations (docker-compose.services.yml):
task dc-services-up
Run the tests against the endpoints:
./test.sh
Or use the endpoints directly:
curl http://localhost:3007/persons/
Use the tasks are available during the work:
task list
* build: Build a single binary application from the source code
* build-docker: Build docker image
* clean: Clean temporary files and folders
* coverage: Test coverage
* dc-down: Clean up docker containers
* dc-logs: Get all docker container logs
* dc-logsf: Get all docker container logs and follow
* dc-services-down: Clean up services docker containers
* dc-services-up: Start services docker containers
* dc-stop: Stop docker containers
* dc-up: Start docker containers
* dc-upd: Start docker containers in the background
* default: Executes all the tests then build the binary
* dockerfile-lint: Run the dockerfile linter
* docs: Generate module documentation into the docs/ folder
* format: Autoformat the source files
* install: Install the package and its dependencies
* install-dev: Install the package and its dependencies for development
* install-dev-editable: Install the package and its dependencies for development with editability
* install-git-hooks: Install git hooks
* lint: Run python linter
* pre-commit: Runs the QA tasks from a git pre-commit hook
* push-docker: Push docker image
* test: Run all the tests
* test-verbose: Run all the go tests
* venv-create: Create a new Python Virtual Environment under the local folder
The scripts and documentation in this project are released under the MIT License