Quickstart

Requirements:

  • docker
  • python3
  • pip3
  • aiolambda-cli:
    pip install -U aiolambda

Create project:

Use aiolambda-cli to initialize project dir:

$ aiolambda-cli init jwt

API specs:

Define microservice OpenAPI specs, for example:

  /auth/{user_id}:
    get:
      tags:
      - auth
      summary: Return JWT token
      operationId: jwt.handlers.auth_handler
      parameters:
      - name: user_id
        description: User unique identifier
        in: path
        required: true
        example: 12
        schema:
          type: integer
      responses:
        '200':
          description: JWT token
          content:
            'application/json':
              schema:
                type: string

Code

Define your custom handlers referenced in openAPI specs. For example, auth_handler:



async def auth_handler(user_id: str) -> Response:
    return compose(
        generate_token,
        logger.debug,
        return_200)(user_id)


Useful commands:

  • make lint
  • make run
  • make test

See example jwt README.md: