Prepare monorepo
This commit is contained in:
parent
a1ddb43ed0
commit
938582155d
61 changed files with 5 additions and 5 deletions
51
backend/app/main.py
Normal file
51
backend/app/main.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
from dotenv import load_dotenv
|
||||
from fastapi import APIRouter, FastAPI
|
||||
from starlette.middleware.authentication import AuthenticationMiddleware
|
||||
|
||||
load_dotenv()
|
||||
|
||||
from app.routers import (
|
||||
auth_v1,
|
||||
chargepoint_v1,
|
||||
id_token_v1,
|
||||
me_v1,
|
||||
meter_value_v1,
|
||||
ocpp_v1,
|
||||
transaction_v1,
|
||||
user_v1
|
||||
)
|
||||
from app.security.websocket_auth_backend import BasicAuthBackend
|
||||
|
||||
def create_ocpp_app():
|
||||
app_ocpp = FastAPI(
|
||||
responses={404: {"description": "Not found"}},
|
||||
)
|
||||
app_ocpp.include_router(ocpp_v1.router)
|
||||
app_ocpp.add_middleware(AuthenticationMiddleware, backend=BasicAuthBackend())
|
||||
|
||||
return app_ocpp
|
||||
|
||||
def create_app():
|
||||
app = FastAPI(
|
||||
title="simple-ocpp-cs",
|
||||
summary="Simple implementation of a basic OCPP 2.0.1 compliant central system (backend) for EV charging stations",
|
||||
responses={404: {"description": "Not found"}},
|
||||
)
|
||||
|
||||
api_v1_router = APIRouter(
|
||||
prefix="/api/v1"
|
||||
)
|
||||
api_v1_router.include_router(auth_v1.router)
|
||||
api_v1_router.include_router(chargepoint_v1.router)
|
||||
api_v1_router.include_router(id_token_v1.router)
|
||||
api_v1_router.include_router(me_v1.router)
|
||||
api_v1_router.include_router(user_v1.router)
|
||||
api_v1_router.include_router(meter_value_v1.router)
|
||||
api_v1_router.include_router(transaction_v1.router)
|
||||
|
||||
app.include_router(api_v1_router)
|
||||
app.mount(path="/v1/ocpp", app=create_ocpp_app())
|
||||
|
||||
return app
|
||||
|
||||
app = create_app()
|
Loading…
Add table
Add a link
Reference in a new issue