Metadata-Version: 2.1
Name: fastapi-startup
Version: 0.1.0
Summary: An opinionated startup extension for FastAPI.
Author-email: Håvard Vidme <havard.vidme@kartverket.no>
Requires-Python: >=3.6.1
Description-Content-Type: text/markdown
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Requires-Dist: fastapi >=0.65.2
Requires-Dist: black ; extra == "dev"
Requires-Dist: isort ; extra == "dev"
Requires-Dist: pytest ; extra == "test"
Requires-Dist: requests ; extra == "test"
Project-URL: Home, https://github.com/vidhav/fastapi-startup
Provides-Extra: dev
Provides-Extra: test

# FastAPI Startup

An opinionated startup extension for FastAPI.

## Usage

```python
from fastapi_startup import FastAPIStartup

app = FastAPIStartup(
    site_name="My site",
    swagger_favicon_url="https://example.com/favicon.ico",
)
```

## Opinions

This is an opinionated way to start FastAPI:

- No ReDoc.
- Swagger is hosted at the `root_path`.
- Swagger UI oAuth2 redirect URL is `/oauth2-redirect`.
- Endpoint `/ping` responds with the plain text response "pong".
- Mounts static directory at `/static` (default).
- Title and site name in Swagger
- Swagger assets:
  - Expects a Favicon - `favicon.ico` - in the static directory.
  - Expects Swagger CSS - `./static/swagger-ui.min.css` - in the static directory.
  - Expects Swagger JS - `./static/swagger-ui-bundle.min.js` - in the static directory.

## Config

Configure FastAPI as usual. Extra arguments (that can be accessed from `app.extra`):

| Name | Default | Description |
| --- | --- | --- |
| `site_name` | Swagger UI | Displayed in the Swagger title, with `app.title`. |
| `static_dir` | static | Where to mount the static directory. |
| `swagger_css_url` | /swagger-ui.min.css | URL to Swagger UI CSS file. |
| `swagger_favicon_url` | /favicon.ico | URL to your Favicon. |
| `swagger_js_url` | /swagger-ui-bundle.min.js | URL to Swagger JS bundle file. |

*If the `swagger_` arguments starts with a "/", they will be loaded from "static", else it will be treated as a URL.*

