can anyone help me to setup the quick start with fastapi? im using self hosted with docker, i alread...
v

Vrl

over 2 years ago
can anyone help me to setup the quick start with fastapi? im using self hosted with docker, i already try the docs and kinda work, but there's no routes, its like i dont do it here is my code:
python
import uvicorn
 
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

# Core Application Instance
app = FastAPI(
    title='Oasys Pipeliner',
    version='v1.0.0',
)

from supertokens_python import init as supertokens_init
from supertokens_python import InputAppInfo, SupertokensConfig
from supertokens_python.recipe import emailpassword, session
from supertokens_python.framework.fastapi import get_middleware
from supertokens_python import get_all_cors_headers

from supertokens_python.recipe import userroles

supertokens_init(
    app_info=InputAppInfo(
        app_name="oasys",
        api_domain="http://localhost:8000",
        website_domain="http://localhost:8000",
        api_base_path="/auth",
        website_base_path="/auth"
    ),
    supertokens_config=SupertokensConfig(
        # try.supertokens.com is for demo purposes. Replace this with the address of your core instance (sign up on supertokens.com), or self host a core.
        connection_uri="http://localhost:3567",
        # api_key="IF YOU HAVE AN API KEY FOR THE CORE, ADD IT HERE"
    ),
    framework='fastapi',
    recipe_list=[
        session.init(), # initializes session features
        emailpassword.init()
    ],
    mode='wsgi' # use wsgi if you are running using gunicorn
)

app.add_middleware(
    CORSMiddleware,
    allow_origins=[
        "http://localhost:8000"
    ],
    allow_credentials=True,
    allow_methods=["GET", "PUT", "POST", "DELETE", "OPTIONS", "PATCH"],
    allow_headers=["Content-Type"] + get_all_cors_headers(),
)

if __name__ == "__main__":
   uvicorn.run("main:app")