Skip to main content

No project description provided

Project description

Wrap fastapi endpoints with RESTful API

Modern frontend frameworks encourage backend developers to follow RESTful API design. This package wraps fastapi endpoints with following structure:

{
  "data": {
    ...
  },
  "code": 200,
  "message": ""
}

and modify fastapi generated OpenAPI documentation to reflect the change.

Installation

pip install fastapi-restful-rsp

Usage

from fastapi import FastAPI
from fastapi_restful_rsp import restful_response

app = FastAPI()

@app.get("/foo/")
@restful_response
def foo()-> str:
    return "Hello World"

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

fastapi_restful_rsp-0.1.2.tar.gz (1.9 kB view hashes)

Uploaded Source

Built Distribution

fastapi_restful_rsp-0.1.2-py3-none-any.whl (2.4 kB view hashes)

Uploaded Python 3

Supported by

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