Skip to main content

A simple web framework for aws lambda

Project description

WellAPI

pip

WellAPI is a simple web framework for work with AWS Lambda and API Gateway. It is designed to be easy to use and flexible, allowing you to create RESTful APIs quickly and efficiently.

Features

  • Simple and intuitive API for defining routes and handling requests
  • Support for middleware functions
  • Automatic request validation and error handling
  • Support for CORS
  • Support for query parameters, path parameters, and request bodies
  • Support for error handling
  • Support for AWS Lambda and API Gateway

Installation

You can install WellAPI using pip:

pip instsll wellapi

Example

from wellapi import WellApi

app = WellApi()

@app.get("/hello")
def hello():
    return {"message": "Hello, World!"}

Local development

You can run your WellAPI application locally using the wellapi command:

wellapi run main:app

Deploy

from wellapi.build.cdk import WellApiCDK


class MyStack(Stack):
    def __init__(self, scope: Construct, id_: str, **kwargs) -> None:
        super().__init__(scope, id_, **kwargs)

        app = WellApiCDK(
            self,
            "WellApiCDK",
            app_srt="main:app",
            handlers_dir="handlers",
        )

CORS

You can enable CORS for your API by setting the cors parameter to True when creating the WellApiCDK instance:

from wellapi.build.cdk import WellApiCDK


class MyStack(Stack):
    def __init__(self, scope: Construct, id_: str, **kwargs) -> None:
        super().__init__(scope, id_, **kwargs)

        app = WellApiCDK(
            self,
            "WellApiCDK",
            app_srt="main:app",
            handlers_dir="handlers",
            cors=True,
        )

Cache

You can enable caching for your API by setting the cache_enable parameter to True when creating the WellApiCDK instance:

from wellapi.build.cdk import WellApiCDK


class MyStack(Stack):
    def __init__(self, scope: Construct, id_: str, **kwargs) -> None:
        super().__init__(scope, id_, **kwargs)

        app = WellApiCDK(
            self,
            "WellApiCDK",
            app_srt="main:app",
            handlers_dir="handlers",
            cache_enable=True,
        )

!!! WARNING !!!

Caching support only GET endpoints

Logging

You can enable logging for your API by setting the log_enable parameter to True when creating the WellApiCDK instance:

from wellapi.build.cdk import WellApiCDK


class MyStack(Stack):
    def __init__(self, scope: Construct, id_: str, **kwargs) -> None:
        super().__init__(scope, id_, **kwargs)

        app = WellApiCDK(
            self,
            "WellApiCDK",
            app_srt="main:app",
            handlers_dir="handlers",
            log_enable=True,
        )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wellapi-0.9.2.tar.gz (60.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wellapi-0.9.2-py3-none-any.whl (59.9 kB view details)

Uploaded Python 3

File details

Details for the file wellapi-0.9.2.tar.gz.

File metadata

  • Download URL: wellapi-0.9.2.tar.gz
  • Upload date:
  • Size: 60.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.14

File hashes

Hashes for wellapi-0.9.2.tar.gz
Algorithm Hash digest
SHA256 9f73b7e40436bd58cb2879c7d67843e71e89164fd2120d73a44b7ec377bbf832
MD5 40b6641a34784df6cc0cc3336d6c5d8c
BLAKE2b-256 d2662070ffb43d06c22380fdb6b934c3bec6f6916dbd9e7316232f36ecab6588

See more details on using hashes here.

File details

Details for the file wellapi-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: wellapi-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 59.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.14

File hashes

Hashes for wellapi-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ba67d7e0e179f6e19a99969a96d1de7cc3e8aae6ea1cf562c76c37761abac77a
MD5 93d4b283b8ff62edd3f7258ae8e4634a
BLAKE2b-256 ed17cc3f34bc6f6a2d0143d40c3dd849a192f8e50c67e6081abd23e3a1216f50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page