29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from fastapi import FastAPI
|
||
from contextlib import asynccontextmanager
|
||
import model.database
|
||
|
||
# 定义程序参数
|
||
APP_NAME: str = 'Findreve'
|
||
VERSION: str = '2.0.0'
|
||
summary='标记、追踪与找回 —— 就这么简单。'
|
||
description='Findreve 是一款强大且直观的解决方案,旨在帮助您管理个人物品,'\
|
||
'并确保丢失后能够安全找回。每个物品都会被分配一个 唯一 ID ,'\
|
||
'并生成一个 安全链接 ,可轻松嵌入到 二维码 或 NFC 标签 中。'\
|
||
'当扫描该代码时,会将拾得者引导至一个专门的网页,上面显示物品详情和您的联系信息,'\
|
||
'既保障隐私又便于沟通。无论您是在管理个人物品还是专业资产,'\
|
||
'Findreve 都能以高效、简便的方式弥合丢失与找回之间的距离。'
|
||
|
||
# Findreve 的生命周期
|
||
@asynccontextmanager
|
||
async def lifespan(app: FastAPI):
|
||
await model.database.Database().init_db()
|
||
yield
|
||
|
||
# 定义 Findreve 服务器
|
||
app = FastAPI(
|
||
title=APP_NAME,
|
||
version=VERSION,
|
||
summary=summary,
|
||
description=description,
|
||
lifespan=lifespan
|
||
) |