Skip to content

jderstd/fastapi

Repository files navigation

JDER FastAPI

A response builder for FastAPI.

This package includes different response builders based on the JSON response structure specified in JSON Data Errors Response (JDER). With the builders, various kinds of responses can be created easily instead of sending plain text responses.

Quick Start

To create a JSON response, use the following code:

from fastapi import FastAPI
from fastapi.responses import Response
from jder_fastapi.responses.json import createJsonResponse

app: FastAPI = FastAPI()

@app.get("/")
async def route() -> Response:
    return createJsonResponse()

And the response will be shown as below:

{
    "success": true
}

Documentation

For the documentation, please refer to the Documentation.

License

This project is licensed under the terms of the MIT license.