Created
February 19, 2021 15:56
-
-
Save Montgoner/5cb9256632b559da5c1cb387f8fc3283 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
from fastapi_versioning import VersionedFastAPI, version | |
app = FastAPI(title="My App") | |
@app.get("/greet") | |
@version(1, 0) | |
def greet_with_hello(): | |
return "Hello" | |
@app.get("/greet") | |
@version(1, 2) | |
def greet_with_hi(): | |
return "Hi" | |
@app.get("/goodbye") | |
@version(1, 1) | |
def say_goodbye(): | |
return “bye” | |
@app.get("/foo") | |
def get_foo(): | |
return “foo” | |
app = VersionedFastAPI(app, default_api_version=(1, 2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment