This project presents a template to develop API Lambdas in Python using:
- FastAPI web framework to create APIs
- Serverless framework to help deploy lambdas in AWS
The reasons that led to the choice of these frameworks can be found in ADR002.
To install poetry and npm dependencies execute: make install.
To run APIs locally execute: make run.
The script will make the api available on localhost:8080.
FastAPI gives Interactive API documentation and exploration web user interfaces. As the framework is based on OpenAPI, there are multiple options, 2 included by default.
- Swagger UI, with interactive exploration, call and test your API directly from the browser. You can access with path
/docs - Alternative API documentation with ReDoc. You can access with path
/redoc
To run tests execute: make test. This will run all tests in the folder tests.
Lint is a static code analysis tool used to flag programming errors, bugs, stylistic errors.
To auto-formatter and execute validations: make lint
To change the validation rules, just edit the .flake8 file. For more details
see: https://flake8.pycqa.org/en/latest/user/violations.html
To deploy it is necessary that the aws credentials are set in .aws folder in config and credentials files. After that just run make deploy.