Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iunary/fastapi-maintenance-mode

FastAPI middleware for enabling maintenance mode
https://github.com/iunary/fastapi-maintenance-mode

fastapi fastapi-middleware maintenance maintenance-mode middleware python3 restapi

Last synced: 8 days ago
JSON representation

FastAPI middleware for enabling maintenance mode

Awesome Lists containing this project

README

        

# FastAPI Maintenance Mode Middleware

FastAPI Maintenance Mode Middleware is a Python package that provides middleware for enabling maintenance mode in FastAPI applications. When maintenance mode is enabled, all incoming requests will receive a 503 Service Unavailable response indicating that the service is temporarily unavailable due to maintenance.

## Installation

You can install the package using `pip`:

```shell
pip install fastapi-maintenance-mode
```

## Example

```python
from fastapi import FastAPI
from fastapi_maintenance_mode import MaintenanceModeMiddleware

app = FastAPI()
app.add_middleware(MaintenanceModeMiddleware, is_maintenance_mode=True)

@app.get("/")
async def root():
return {"status": "Ok"}

```